Message-Id: <2.2.32.19970324164102.0069dc00@mailhost> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Mon, 24 Mar 1997 14:41:02 -0200 To: "Thomas Habets" From: Eyal Ben-David Subject: Re: fstream doesn't work? Cc: djgpp AT delorie DOT com >I've tried to read from a file like this: >File.read(buffer,8); >And it doesn't work, Why? How can I change this so it works? >I got DJGPP 2.01 gcc 2.7.2.1. > I assume that File is an ofstream object. If so, then I think it is a mis-feature (bug ?) in DJGPP (or maybe gcc). I opened the file in binary mode like this: ifstream File("file.ext", ios::binary); and the file doesn't read anything. The correction is: ifstream File("file.ext", ios::binary | ios::in); I read the header 'fstream.h' and it seems that whenever an ifstream is opened as in the first statement ios::in is ORed with the mode. This should correct the problem but somehow the ifstream does not read! when the file is opened without specifying mode (i.e. text-mode) there's no problem. ifstream File("file.ext"); Eyal.