This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ios::binary


I want to be able to write out binary data not character, like fwrite does, or
is that not the purpose of ios::binary?  ie, 4 bytes for a int, etc.

rich_paul@bigfoot.com wrote:

> Under unix, binary file IO is always the case.  Note that in the iostreams
> library, binary means the same thing it means in ftp ... do not convert
> line ends.  therefore:
>
> {
>   int i = 32;
>   ofstream str("tempfile");
>   str << i << endl;
> }
> {
>   char ch;
>   ifstream str("tempfile");
>   str >> ch;
>   cout << ch << endl;
> }
>
> will output the number 3, not a space, regardless of the binary flag.
>
> --------
> Where do you want to crash, toady?
> On Tue, 3 Nov 1998, Thomas Matelich wrote:
>
> > So, binary file IO is unsupported?  Or am I mistaken?
> >
> > --
> > Thomas O Matelich
> > Senior Programmer
> > Zetec, Inc.
> > tmatelich@zetec.com
> > tomsara@slip-stream.net
> >
> >
> >
> >



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]