stream->read(&buffer, X);
Because I don't know X. Since we're talking about a text file (with binary fields on each line) I do, however, have an EOL to indicate when the record has ended. There's a small problem with the fact that the EOL might appear inside one of the binary fields, but let's ignore this at first. My line terminator would be 0x0A on most files (Unix style), but that can be configured in the application. So I read from the file:
unsigned char* buffer[MAX_RECORD_SIZE];
stream->getline((char*)buffer, MAX_RECORD_SIZE, 0x0A);
Where MAX_RECORD_SIZE is a constant that defines the maximum size for any given line. Of course, this is a very large buffer. This method works well. It reads from the input corretly. HOWEVER, I must then findout the size of the line that I read. I thought that this would be accomplished simply by looking up the 0x0A on the file, but I found out that getline doesn't push the terminator on the read bytes. That's where lies my problem, how to determine how many bytes were read? I guessing there's some method that I don't know about, because on ANSI C I could do this very easily (and that's probably what I'm going to do if I can't find an answer).