|
Apr
22 |
|
awarded | Scholar |
|
Apr
22 |
|
accepted | fstream get method not behaving consistently |
|
Apr
1 |
|
comment |
fstream get method not behaving consistently The bad file only had 0A at the end of a line, the correct one also has 0D. This wouldn't have been a problem if Windows had been using just newlines. It's weird that not having a carriage return on position 10 affects how the character at position 0 is read. |
|
Apr
1 |
|
comment |
fstream get method not behaving consistently I figured out why it was happening: Notepad++ saved the file incorrectly: the file has 47 characters in it, counting the newline. Notepad++ saved it as exactly 47 bytes, but Wordpad saves it as 48 bytes. Once saved by Wordpad Notepad++ will also keep it correct. |
|
Apr
1 |
|
comment |
fstream get method not behaving consistently This is just for a personal project, so there's no rush. If reinstalling VS doesn't fix it i'll try to download the library separately, if that won't fix it i can always try using VS 11. |
|
Apr
1 |
|
comment |
fstream get method not behaving consistently I used your example, adding only std::cin.get() to keep the console visible, and it gave 1 for the second position. |
|
Apr
1 |
|
comment |
fstream get method not behaving consistently I tried ifstream and fstream, they both have the same issue. I'm reinstalling VS2010, once it's finished i'll try again. |
|
Apr
1 |
|
comment |
fstream get method not behaving consistently It happens even in a separate project. I checked the assembly listing, it shows that it still calls the get method, so i don't think it's optimizing it out. I put this code in a loop and output the position and character, it says that the first 2 characters both have the 0th position. I'll try reinstalling the library, if that doesn't work i don't know what else to try. |
|
Apr
1 |
|
comment |
fstream get method not behaving consistently There's definitely no comments anywhere near the code, since the characters it returns show that it is incrementing the get pointer, it means that the value that tellg is returning isn't being handled correctly. I'll try to run this code in a separate project to see if it still happens. |
|
Apr
1 |
|
awarded | Student |
|
Apr
1 |
|
asked | fstream get method not behaving consistently |