delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/28/22:46:16

From: "Steve Patton" <leaphe AT pemail DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: read / write errors
Date: Sun, 28 Dec 1997 20:24:48 -0700
Organization: AT&T WorldNet Services
Lines: 48
Message-ID: <687572$4vq@bgtnsc02.worldnet.att.net>
References: <684pm4$9ta AT mtinsc05 DOT worldnet DOT att DOT net> <34A69420 DOT FABC7F0 AT LSTM DOT Ruhr-UNI-Bochum DOT De>
NNTP-Posting-Host: 12.67.33.44
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Thomas Demmer wrote in message <34A69420 DOT FABC7F0 AT LSTM DOT Ruhr-UNI-Bochum DOT De>...

>BTW, this code looks like C++, so once your at it, why not use
>the stream functions? Although this is just aesthetic and you'll
>hit the same problem there (and maybe others...)


Well just the variable initialization (which of course is now how I went at
it in the actual source), but as a matter of fact, yes, I have run into
extreme problems with the fstream class, when reading from a file, it would
allow me to open a file, would register an error, such as

ofstream In;
char buf[10000];

In.open ( "wow.txt" );

if ( !In )
  {
     cout << "Error!";
     exit ( 1 );
  }

while ( In >> buf )
 {
      // do stuff
 }

In.close();


It would open correctly, but it would register that the file had nothing in
it, of course this was for school, so I just used their VC++ and it worked
fine (the same exact code).  I would have posted that problem as well, but I
don't have any use for the fstream, so I didn't think about posting it.

(and here are my versions
bnu27b
djdev201
gcc2721b
gpp2721b
lgp271b
and I do believe they are the most recent)

-Steve


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019