delorie.com/archives/browse.cgi | search |
From: | "Alex P." <roboto11 AT hotmail DOT com> |
Newsgroups: | alt.comp.lang.learn.c-c++,comp.lang.c++,comp.os.msdos.djgpp |
References: | <nj7x6.782$ym1 DOT 6435 AT nntp1 DOT chello DOT se> <YOjx6.6567$MZ2 DOT 1113022 AT news2-win DOT server DOT ntlworld DOT com> |
Subject: | Re: Need some help with reading from files |
Lines: | 28 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.00.2919.6700 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2919.6700 |
Message-ID: | <2YKx6.176084$tP3.2695751@news1.rdc1.bc.home.com> |
Date: | Sun, 01 Apr 2001 19:03:26 GMT |
NNTP-Posting-Host: | 24.113.131.218 |
X-Complaints-To: | abuse AT home DOT net |
X-Trace: | news1.rdc1.bc.home.com 986151806 24.113.131.218 (Sun, 01 Apr 2001 12:03:26 PDT) |
NNTP-Posting-Date: | Sun, 01 Apr 2001 12:03:26 PDT |
Organization: | Excite AT Home - The Leader in Broadband http://home.com/faster |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
"John Harrison" <jahhaj AT bigfoot DOT com> wrote in message news:YOjx6.6567$MZ2 DOT 1113022 AT news2-win DOT server DOT ntlworld DOT com... [snip] > > Despite what others have told you about seekg, it is an error to pass > anything to seekg that isn't either the end of file, the start of file or a > position previously returned from tellg UNLESS you are dealing with a binary > file. You want to use a text file so seekg is going to be of limited use to > you (unless you want to write non-portable code). What I wrote *is* portable. There is no rule that says "you can't use seekg with text files" and that it's an "error" to do so. No documentation about seekg says such a thing. It is your choice what method you use to access a character in a file -- seekg is one of them. All you need to do is make sure you take into account the length of platform-dependant eol character(s) (e.g. CR/LF for DOS/Windows) -- which I did by taking into account the eol length with EOL_LEN. Alex
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |