delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/02/10/13:18:16

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: Thu, 10 Feb 94 18:59:22 NFT

  
      Hi,
      I'd already posted this mail a week ago, but got no response.
    
      I've just installed djgpp on my PC (standart 486DX 16MB Ram ...),
      and everything works fine so far, ie. I can compile and run all 
      test's and also a number of programm I wrote for gcc under Linux.
      But I run into problems when using fstream in append mode:  	
      The following program runs well under Linux but crashes under 
      DOS with 'General Protection Fault'. 
      The following lines are the output when running the Program
      with the debugger:
    eax=00000020  ebx=00056004  ecx=0005697e  edx=0000097a
    esi=4e9e097a  edi=00000005  ebp=00051a64     RF       UP IE    PL NZ    PO NC
    ds=00a7 es=00a7 fs=00a7 gs=00bf ss:esp=00b7:00051a3c cs=00af
    exception 13 (0xd) occurred, error code=0x80000000
    00007b72: ffd6           call    esi                 esi=4e9e097a
    
      This error happens in filebuf::open(char* ,ios::openmode ,int),
      but I can't figure out, whats wrong. 
      Did anyone had encountered the same problem or any ideas what
      I am doing wrong ?
      
      Thanks in advance
     Bernd   
    -------------------------      
      #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::ate); 
      //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
      Germany 
      bheuman AT msfp31 DOT gwdg DOT de

- Raw text -


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