Subject:
|
Re: L3P v1.3 for Mac OSX
|
Newsgroups:
|
lugnet.cad.dev.mac
|
Date:
|
Thu, 12 Dec 2002 09:27:58 GMT
|
Viewed:
|
1595 times
|
| |
| |
In lugnet.cad.dev.mac, Travis Cobbs writes:
> In lugnet.cad.dev.mac, Lars C. Hassing writes:
> > /* Like fgets, except that 1) any line ending is accepted (\n (unix),
> > \r\n (DOS/Windows), \r (Mac (OS9)) and 2) Str is ALWAYS zero terminated
> > (even if no line ending was found) */
>
> Umm, fgets already does what 2) says
Right! I must have been sleeping or thinking of strncpy...?
Please delete 2) from the comment.
> One other thing. If you're not already doing so, make sure to open your
> files in binary mode. There is a bug in fseek that can occur when you fseek
> in a text file in Windows (based on the location returned by ftell). It
> appears to happen when you fseek to a location that Windows thinks is
> already in the FILE buffer. It then seeks to the wrong location due to the
> fact that the CRs were stripped out of the buffered data. I don't think
> ungetc uses fseek, but I'm also not sure it's guaranteed not to.
According to the CRT source ungetc doesn't use fseek,
but with L3fgets the need to open in text mode has gone,
so I might as well open in binary mode. Thanks.
/Lars
|
|
Message is in Reply To:
| | Re: L3P v1.3 for Mac OSX
|
| (...) Umm, fgets already does what 2) says above (unless you mean when end of file is reached and the function returns NULL). I'm not actually sure what goes into the string when fgets returns NULL. If no line ending is found (either due to EOF (...) (22 years ago, 11-Dec-02, to lugnet.cad.dev.mac)
|
42 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|