delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/02/07/11:10:15

From: bheuman AT msfp31 DOT gwdg DOT de (Bernd Heumann)
Subject: Opening files for append
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Mon, 7 Feb 94 16:22:13 NFT

Hi
I'm trying to port some programms from Linux to DOS and got 
problems when opening Files in append mode.
The following program runs well under Linux but crashes under 
DOS with 'General Protection Fault'. 
Any Ideas ?

#include <iostream.h>
#include <fstream.h>
main()
{
  cout << "Hallo \n";

/* Working Code */
//ofstream outf("Test.Out");
//ofstream outf("Test.Out",ios::out | ios::text);

/* Failing Code   */
  ofstream outf("Test.Out",ios::app);
//ofstream outf("Test.Out",ios::out | ios::text | ios::app);

  cout << "Writing to File \n";
  for (int i=1;i<=10;i++)
    outf << " Line " << i << "written \n" ;
}


Bernd Heumann
MPI fuer Stroemungsforschung
37073 Goettingen
Gemany 
bheuman AT msfp31 DOT gwdg DOT de


- Raw text -


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