How it's possible to read characters from file without loosing the spaces?
I have a file which contains for istance this:
The quick brown fox jumps over the lazy dog.
When I read from file (a character a time), I lose the spaces, but the all other characters are correctly read. Why?
This is an example of code:
unsigned int cap = (unsigned)strlen("The quick brown fox jumps over the lazy dog."); char c[cap]; int i = 0; while (!fIn.eof()) { fIn >> c[i]; ++i; } for (int i = 0; i < cap; i++) cout << c[i]; When i print the array, all spaces are missing. Could you tell me how I can avoid this problem?