From: Martin Juul Newsgroups: comp.os.msdos.djgpp Subject: fstream bug? Date: Tue, 22 Sep 1998 14:36:21 +0200 Organization: University of Aarhus, Department of Computer Science (DAIMI) Lines: 46 Message-ID: <360799C5.5FCA@mi.aau.dk> NNTP-Posting-Host: elrond.imf.au.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Date: 22 Sep 1998 12:36:23 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk // filsplitter A file made in this way get a size bigger than 40bytes if compiled by gxx on dos(under win95) it looks to mee like a serious bug in the fstream? can anyone confirm that it poses a prob. to compile this under win95, maybe solve it? #include #include #include const int blok=40; int main(void) { char indblok[blok]; long j; ifstream indfil("mj.txt", ios::in); if(!indfil){ cerr << "Fejl ind" << endl; exit(1); } indfil.read((char *)&indblok, blok); indfil.seekg(0,ios::end); j=indfil.tellg(); cout << "?" << j << "?";//prints file size ofstream udfil("mj1.txt", ios::out); if(!udfil){ cerr << "Fejl ud" << endl; exit(1); } udfil.seekp(0); cout << udfil.tellp(); udfil.write((char *)&indblok, blok); cout << udfil.tellp(); return 0; }