delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/18/14:56:48

From: "Jon" <lobo AT iamerica DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Possible bug in ifstream!
Date: 18 Mar 1997 16:46:51 GMT
Organization: LDS I-America
Lines: 19
Message-ID: <01bc336f$aa859980$5cbc65cf@default>
NNTP-Posting-Host: 207.101.188.92
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I was working on opening a file for readonly access and I was
having problems geting it to read the whole file. 

	ifstream fp("some file");
	fp.read(buffer,filesize);
	fp.close;

when I changed the first like to this, it worked line the above
should:

	fstream fp("some file", ios::in | ios::binary);

when I added different mode's to ifstream, it wrote more or less
bytes.

ios::in | ios::binary 		wrote almost %80 percent of file
ios::binary				did not read any bytes from the file

I'm using djgpp gcc 2.00. 

- Raw text -


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