ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/07/27/11:24:32

From: Mr WT Wong <wtwong AT fawlty9 DOT eng DOT monash DOT edu DOT au>
Subject: Bug in ostream
To: djgpp AT sun DOT soe DOT clarkson DOT edu (DJGPP List)
Date: Wed, 27 Jul 1994 23:54:17 +1000 (EST)

Hi everyone,
	I've encountered a problem when I open an output stream in 
	append mode. The program simply crashes. Below is the listing of
	the program. It compiles but doesn't run.
	
#include <fstream.h>
#include <stdlib.h>

int main()
{
   int mode = ios::out|ios::app;
   ofstream os("main2.out", ios::out|ios::app);
// ofstream os("main2.out", ios::out); // this works!
   if (!os)
   {
      cerr << "unable to open file\n";
      exit (-1);
   }
   os << "This is a test\n";
   os.close();
}

	I've tried this program out using gcc on a DecStation which is version
	2.5.6 and it works. Could this be a bug in the gpp library ?
	I've installed all the maintenance files and the libgpp.a file is
	dated 12/15/93.
	Thanks for any replies.
	
regards,
John
-- 
John Wong                   |        Tel : 905 5535
Elec. & Comp. Systems Eng.  |      email : wtwong AT fawlty7 DOT eng DOT monash DOT edu DOT au
Monash University           | 
Clayton, Victoria           |      "Do it or do it not, there is no try"
Australia                   |             - Yoda, TESB            



- Raw text -


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