X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: info AT hoekstra-uitgeverij DOT nl (Richard Bos) Newsgroups: comp.lang.c,comp.os.msdos.djgpp,comp.lang.c++ Subject: Re: String substitution to another Date: Mon, 10 Dec 2001 11:39:48 GMT Organization: Go wash your mouth. Lines: 40 Message-ID: <3c149894.7181858@news.tiscali.nl> References: <3C151123 DOT D1E94FE8 AT surfeu DOT fi> NNTP-Posting-Host: vp177-236.worldonline.nl X-Trace: reader1.tiscali.nl 1007984025 9346 195.241.177.236 (10 Dec 2001 11:33:45 GMT) X-Complaints-To: newsmaster AT tiscali DOT nl NNTP-Posting-Date: Mon, 10 Dec 2001 11:33:45 +0000 (UTC) X-Newsreader: Forte Free Agent 1.21/32.243 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Mr. Veli Suorsa" wrote: > >"Mr. Veli Suorsa" wrote: [This bit was me, though: ] > >Note also that this: > > > >> gets( filename ); > > > >is an evil function, which you shouldn't use under any circumstances > >excepting physical duress above the "agony" level, and that this: > > > >> while ( !feof( fileptr ) ) > >> { > >> fgets( strline, MAXLINELEN, fileptr ); > > > >> } > > > >is not the best way to read a file, because: > >. > > Don't worry about "evil functions", Richard, code seems to work very > well. That's what people thought before the Internet worm struck, yes. Believe you me: every single use of gets() is a mistake. Sooner or later, you _will_ get bitten by it. As for the bug involving feof(): have you read that page? The bug does exist. Mind you, it _is_ possible to use feof() correctly. It is usually needlessly involved, but it can be done. If you want code that is obviously correct, though, you usually want to avoid it. > No warnings, no errors in my test compiler as usual ;-) So? I can write programs that are syntactically correct, and perfect C, but that will print insults to my boss' heredity when run. I do not expect a C compiler to catch logic errors, only syntax errors. Richard