Mail Archives: djgpp/1998/12/09/10:05:45
From: | Klaus Petzold <Klaus AT ostenberg DOT ping DOT de>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Problem with reading from file
|
Date: | Wed, 09 Dec 1998 15:36:40 +0100
|
Organization: | Private Internet Nutzer Gemeinschaft e.V.
|
Lines: | 31
|
Message-ID: | <366E8AF8.66A4549B@ostenberg.ping.de>
|
NNTP-Posting-Host: | ostenberg.ping.de
|
Mime-Version: | 1.0
|
X-Mailer: | Mozilla 4.06 [de] (Win95; I)
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi,
I am using gcc 2.7.2.1 and try to do
the following:
#include <iostream.h>
#include <stdlib.h>
#include <fstream.h>
int main()
{
ifstream Quelle;
Quelle.open("test.dat", ios::binary);
if (!Quelle)
{
cout << "File not found.";
exit(-1);
}
char ch;
while (Quelle.read((char *)&ch, sizeof(ch)))
cout << ch;
}
Test.dat exists and is 10 bytes large, but the program
doesn't enter the while-loop. Any ideas why it doesn't work?
Klaus
- Raw text -