If opened as binary, there will be no conversion on input. If opened as text then there may be some conversions. For example, in Windows \r\n will be reduced to just \n. This may affect the "length" of your input.
However, you have other problems with your code.
- char a[length] is illegal in standard C++ (but allowed in the C99 version of C and in other languages with run-time allocatable arrays.)
- you are using cout << a; but your c-string isn't null-terminated.
For example, in Windows \r\n will be reduced to just \n. This may affect the "length" of your input.
"int length" is equal to 2204(with and without mode: binary). If tellg() returns two chars for a newline even on a windows system, then that might be the problem. Because in that case i'm telling it to read in more than the "real" file length.
The array works for now, but I changed it to length + 1.
But that's not what's causing the repetition. Could it have to do with my theory in my last post?
"int length" is equal to 2204(with and without mode: binary). If tellg() returns two chars for a newline even on a windows system, then that might be the problem. Because in that case i'm telling it to read in more than the "real" file length.