delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/11/19:31:25

From: Marius <nospam AT geocities DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: problem with fstream it erases my input file !
Date: Tue, 11 Nov 1997 19:52:43 +0100
Organization: Rijksuniversiteit Groningen
Lines: 30
Message-ID: <3468A97A.E24ED7D7@geocities.com>
NNTP-Posting-Host: client36-97.oprit.rug.nl
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello

I have the following problem :

After I execute the following code with an argument at the commandline
e.g. :
test.exe test.txt
The file test.txt is empty (it wasn't before)

the code :

#include <fstream.h>

int main(int argc, char *argv[])
{
    fstream                         // open the file to read and write
        stream(argv[1],ios::in | ios::out);
}

My C++ teacher executed this code with GNU C++ on linux and it worked
fine.
However when I run it (on DOS DJGPP GNU C++) it empties my argument
file.

Has anyone using DJGPP had the same problem, if so some help would be
nice because I don't know what's wrong.

Greetings
Marius

- Raw text -


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