Mail Archives: djgpp/1998/09/22/08:45:18
From: | Martin Juul <mj AT mi DOT aau DOT dk>
|
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
|
NNTP-Posting-Date: | 22 Sep 1998 12:36:23 GMT
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
// 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 <iostream.h>
#include <fstream.h>
#include <stdlib.h>
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;
}
- Raw text -