www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/03/03:41:08

Message-ID: <00a101bda655$798f3020$200d18ac@OSEK12.hosp.dk>
From: "=?iso-8859-1?Q?S=F8ren_Merser?=" <merser AT inet DOT uni2 DOT dk>
To: "DJGPP" <djgpp AT delorie DOT com>
Subject: Re: writing binary data
Date: Fri, 3 Jul 1998 09:37:43 +0200
MIME-Version: 1.0

I'm using Outlook Ekspress with 'plain text.' If encoded, what more do I
haveto do?

My problem is writing a binary file using STL and iostream; I thought that
this should work:

vector<TYPE> v;
- populate vector and print vector to stdout - works fine OK

// open output file stream in binary mode
ofstream ofs("data.dat",  ios::out | ios::bin | ios::trunc );

// create iterator
ostream_iterator<TYPE> ofi(ofs," ");

// write to file
copy(v.begin(), v.end(), ofi);

This code compiles but just writes an odinary asci file??

Any help appreciated

- Raw text -


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