Best way to read binary file c++ though input redirection
问题 I am trying to read a large binary file thought input redirection ( stdin ) at runtime, and stdin is mandatory. ./a.out < input.bin So far I have used fgets. But fgets skips blanks and newline. I want to include both. My currentBuffersize could dynamically vary. FILE * inputFileStream = stdin; int currentPos = INIT_BUFFER_SIZE; int currentBufferSize = 24; // opt unsigned short int count = 0; // As Max number of packets 30,000/65,536 while (!feof(inputFileStream)) { char buf[INIT_BUFFER_SIZE];