Quick, question, at the very end of my very last function, i do
w = feof(filePtr1)
and then
while(w != 0)
but that dont work, what will feof return if its at the end of the file?
Quick, question, at the very end of my very last function, i do
w = feof(filePtr1)
and then
while(w != 0)
but that dont work, what will feof return if its at the end of the file?
y is declared in fill_struct_integers but isnt initialized (set to anything). you do print it though, but it will likely have some random variable in it.
edit:i believe the FAQ has something about controlling loops using the check of EOF, check it out.The function feof() tests the end-of-file indicator for the stream
pointed to by stream, returning non-zero if it is set. The end-of-file
indicator can only be cleared by the function clearerr().p
Last edited by nadroj; 12-03-2007 at 07:52 PM.
Ty, i just realised that I used it right before in the same program..., i think i need a nap...
My teacher thougt me it that way, im sorry...
That and fflush(stdin)....
Last edited by Tyrant; 12-03-2007 at 08:00 PM.
I got it, I'ill stop reading the file exactly before the end of file...
Nice.... it works....
Last edited by Tyrant; 12-03-2007 at 08:28 PM.
As to the original question: In standard C prior to C99, you can't declare variables in places other than beginning of a block [that means, the variables must be before any "code" within the particular set of braces].
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.