Cprogramming.com: FAQ
And what does not appended correctly mean, exactly?
Cprogramming.com: FAQ
And what does not appended correctly mean, exactly?
Do not use feof() to control loops!
Use your read function to check if it was possible to read or not.Code:while(!feof(log))
--
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.
FYI, it's a terrible idea to write a message board with C.
It's basically like opening the web server up to the world with the thousand of bugs you're introducing (either knowingly or not).
So if you plan to use this... don't
I totally agree. You can't write any real programs in C! It's just for hello world!
Quzah.
Hope is the first step on the road to disappointment.
That was sarcasm actually.
Quzah.
Hope is the first step on the road to disappointment.
As long as there are no bugs though, there are no security vulnerabilities. Btw, does anybody know how to prevent the error where the message board can't access the text file because Apache doesn't allow it? That's really the last step to finishing the message board.
-Kernel SandersFried chicken for everybody!
Now we just have to hope that test programs don't become part of programs that people use....
do not use feof to control loop - read faq
use return value of fgets instead
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
fopen will either fail or succeed. No error will be printed by Apache.
If the program crashes, however, you can be sure you will get an error.
Therefore, properly check the return of fopen to make sure you don't call any other file functions if it didn't succeed. Then you can choose what you want to do about it.