file io - Why is this C code buggy? -


on, the following is indicated:

This (probably) is not actually related to you The question is, but while (.fif (fileprint)) { is a very guaranteed bug.

I thought I would start a different question because in that comment to some extent beyond the subject. Can anyone explain this to me? This was the first program I had written directly in C.

The reason for this statement is that FOF still (initially) Incorrect when the file is finished - it gets right after the first unsuccessful attempt before reading it at the end of the file.

Therefore

four bitures; While (.fife (fileprint)) {Fred (and Mitter, Psychoph (Chair), 1, Filiped); Fprintf (stderr, "the four is '% c'. \ N", mychar); }

One four will process a lot.

The correct way is to check the return value of fread (or whatever you're using to read again) or alternatively, feof Function to read after . For example:

  four bitches; While (feeds (and matures, psychophagus (chair), 1, fileprist), fprintf (stderr, "the four is '% c'. \ N", mychar);  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -