Streaming file input problem
What's the easiest way to stream unsigned short ints from a binary file into an array of unsigned short ints?
I expected the language to be able to understand how to stream from an ifstream into the array but it appears
to need delimiters between each unsigned short int in the file. Unfortunately, my "real" input file won't have delimiters.
I was doing something like this:
unsigned short int bytesRead[MAX_VALS];
ifstream inputFile(INPUT_FILE_NAME, ios::in | ios::binary | filebuf::sh_none);
while(!dataFile.eof() && bytesRead <= MAX_VALS)
inputFile >> values[bytesRead++];