delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/27/15:15:38

From: Paul Shirley <Paul AT chocolat DOT obvious DOT fake DOT foobar DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Binary streams...
Date: Fri, 27 Mar 1998 19:37:35 +0000
Organization: wot? me?
Lines: 19
Message-ID: <wJy2zDA$$$G1EwLY@foobar.co.uk>
References: <19980326011928 DOT 13219 DOT qmail AT www06 DOT netaddress DOT usa DOT net>
NNTP-Posting-Host: chocolat.foobar.co.uk
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <19980326011928 DOT 13219 DOT qmail AT www06 DOT netaddress DOT usa DOT net>, Carl
Kalauokalani <ckalauokalani AT usa DOT net> writes
>I'm having a bit of trouble using binary streams via djgpp.
>The code below (which I borrowed from the Borland support
>site) serves to demonstrate the problem; with the MS or
>Borland compilers, the two files are created as expected
>(text.txt: 49 bytes, bin.txt: 47 bytes), but with DJ the
>bin.txt file is empty.  Am I missing something?
<snip>
>      ofileb.open( "bin.txt", ios::binary ) ;

     ofileb.open( "bin.txt", ios::binary | ios::out ) ;

gcc needs you to explicitly set the in or out mode if you don't rely on
the default parameter.
I'm not sure if this counts as a bug or not, it is damn annoying ;)

---
Paul Shirley: my email address is 'obvious'ly anti-spammed

- Raw text -


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