On 17 Jan 2002 at 2:15, Hrvoje Niksic wrote: > Michael Jennings <[EMAIL PROTECTED]> writes: > > WGet returns an error message when the .wgetrc file is terminated > > with an MS-DOS end-of-file mark (Control-Z). MS-DOS is the > > command-line language for all versions of Windows, so ignoring the > > end-of-file mark would make sense. > > Ouch, I never thought of that. Wget opens files in binary mode and > handles the line termination manually -- but I never thought to handle > ^Z.
Why not just open the wgetrc file in text mode using fopen(name, "r") instead of "rb"? Does that introduce other problems? In the Windows C compilers I've tried (Microsoft and Borland ones), "r" causes the file to be opened in text mode by default (there are ways to override that at compile time and/or run time), and this causes the ^Z to be treated as an EOF (there might be ways to override that too).