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?
Printable View
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.Quote:
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
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)....
I got it, I'ill stop reading the file exactly before the end of file...
Nice.... it works....
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