johnm@sim.berkeley.edu (John D. Mitchell) (07/11/90)
John Core at home, Harrisburg,PA writes: > while using fgets with turbo C on Ms-dos I get the following problem: ] when reading a char *str with fgets the manual says that ] fgets will stop at num-1 characters or if a read character ] is a newline. ] ] char *fgets(str,num,stream) ] ] I have never had problems with fgets on Unix SYSV but under ] TURBOC ON THE SAME FILE fgets does not always find the ] newline marker, the operation is at times unpredictable. ] since it seems to miss the newline char it the continues to ] read the following lines in the file untill the num-1 is ] satisfied. ] ]Has anyone else had experience with this problem. If you can help or ]al least tell me I am doing something wrong, or that it is a bug >Thanks in advance I don't know for sure but I've had similar problems that were NOT caused by the *input* routine (i.e. fgets()). The problem was caused by having the file end only with a EOF instead of an EOLN,EOF pair. In english (I hope) the last line of the file was NOT ended with a CR/LF just an EOF. Good Luck, John Mitchell johnm@sim.Berkeley.EDU #include <disclaimer.std>