delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/18/16:33:09

To: djgpp AT delorie DOT com
References: <2 DOT 07b4 DOT PZ9S DOT FJ8E10 AT pauzner DOT mccme DOT ru>
<AAr5cRsqg9 AT pauzner DOT mccme DOT ru>
Message-Id: <2.07b5.3MYIJ.FOJEW0@pauzner.mccme.ru>
From: "Leonid Pauzner" <leonid AT pauzner DOT mccme DOT ru>
Date: Tue, 18 Jan 2000 18:26:24 +0300 (MSK)
X-Mailer: dMail [Demos Mail for DOS v2.07b5]
Subject: DJGPP/GPP: can not open C++ [io]fstream in binary mode
Lines: 28
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

I run into the following problem:

using DJGPP 2.02-2.03 and GCC/GPP 2.81 or 2.95.1
on a plain i386/DOS 6.22 machine
I can not open fstream in BINARY mode,
e.g. I got zero size file from the sample program below.

If this is G++ problem could you forward this message to
GCC/G++ mailing list, please.

It is OK when I use  FILE *fp; fp = open(somename, "wb");
though.

Leonid.



#include <iostream>
#include <fstream>

int main (int argc, char *argv[])
{
        ofstream fpw (argv[1], ios::binary);

        for (int i=0; i<256; i++) {
                fpw.put( ((char)i) );
        }
}


- Raw text -


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