Message-ID: <000701bf22f1$27db2800$b21509d2@raider> From: "Ryan" To: Subject: Re: best way to read selected data from a file? Date: Sun, 31 Oct 1999 01:39:32 +0930 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Reply-To: djgpp AT delorie DOT com wow...that is so clever yet simple in that i cannot beleive i cannot work stuff like that out... thanks.. -----Original Message----- From: Eli Zaretskii Newsgroups: comp.os.msdos.djgpp To: djgpp AT delorie DOT com Date: Tuesday, 26 October 1999 4:01 Subject: Re: best way to read selected data from a file? > >Ryan wrote: > >> But what If I want to go straight to line 15 and read that line? > >Besides the other suggestions, there's one that frequently gets >overlooked: read the entire file into memory, then scan the buffer >counting \n characters; when you have seen 14 of them, you are at the >beginning of line 15. > >Given the amount of memory available to you in DJGPP, this is much >simpler than messing with fseek, fscanf, and the like. More often than >not, it will be also faster.