« first day (2776 days earlier)      last day (1076 days later) » 

10:47
yay, 3 secret hats
 
5 hours later…
15:19
They showed me this at university, in order to read from a txt file: paste.ofcode.org/…

However, I ran the code and the last number is not read...
Maybe it works in another version of C...?
15:40
Actually it works on Linux, but not on Windows
Aha, it seems to be working on Linux.
@Curio could You please dump hex of Your input.txt file? :}
@Kamiccolo Sorry for my ignorance, but what is dump hex? XD
Technically, You should not use feof() for this loop. Preferably use the result of fscanf instead.
So you mean while(fscanf(...)>0){} ?
507
A: Why is “while ( !feof (file) )” always wrong?

Kerrek SBTL;DR while(!feof) is wrong because it tests for something that is irrelevant and fails to test for something that you need to know. The result is that you are erroneously executing code that assumes that it is accessing data that was read successfully, when in fact this never happened. I'd like ...

15:48
xxd input.txt

00000000: 3120 3220 3320 3420 3520 3620 3720 3820 1 2 3 4 5 6 7 8

00000010: 3920 3130 0a31 3120 3132 0a 9 10.11 12.
Also, as I recall, there was slight difference between Windows and Linux on this matter. I just don't remember what exactly :D
mhm. Weird. I'd suspect that on Windows, somehow, it reads the last number, but still detects EOF while reading in, and by Your logics it does not print the last number. Not so sure about that... Does putting extra space, new line, etc changes anything on Windows?
 
1 hour later…
17:04
@Curio yeah, make sure there is a newline at the end of the file and see if you get better results. using *nix apps on windows myself, all my text files end with newlines. even github for windows shows an "warning" icon telling you the file doesn't end with a newline
aha, new lines are tricky... also, binary/text open(), when You have to deal with Win/NIX :|
Nov 19 '18 at 19:15, by milleniumbug
I like how an unfinished sentence can cause you to have an
gosh, this post gives me anxiety every time i see it in star board lol
--objective complete--
17:22
@Curio also, keep in mind, windows newline is \r\n, nix is \n. Some document editors in windows will automatically convert \n to \r\n if you save over the original file, or will add \r\n if you enter a newline in windows editors. if you then feed that file back to nix system, it could cause oddities because nix is expecting \n but the file contains \r\n. This is why i turn on "View > Show Symbols > Show all characters" in notepad++ so I can see what original source is expecting
@Kamiccolo any big plans for the night of Dec 31?
@Kcvin sleep, mayhaps :} No idea. I hope not to have any sudden support requests from another side of the globe...
18:03
@Kcvin heu heu heu heu
18:21
Thank you all for your clarifications

« first day (2776 days earlier)      last day (1076 days later) »