🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #581

Re: Reading Binary or Hex Data from a File

#581
From: David Harmon
Date: Thu, 03 Feb 2000 00:00
15 lines
1523 bytes
With less than a year remaining till the end of the millennium,
on Thu, 3 Feb 2000 21:07:54 -0800 in comp.lang.c++,
"Alex Sramek" <losal4@mminternet.com> wrote:

>Hi, I have a bunch of .dat files that I need to read with a program I'm
>making.  However, I haven't found a way, with my limited c++ experience, to
>do so.  If fstream is used, special characters will most likely be
>overlooked, and the data I'm reading has a range from 00 to FF. 

Two key points:

1.  Make sure to open the stream with the ios::binary flag.

2.  Do not use operator<< and operator>>.  Use the read() and write()
member functions, or maybe get() and put().
Technical Details
Message-ID: <389f8202.7379027@nntp.ix.netcom.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <s9knkid5dh169@corp.supernews.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1118e6,34922ce457bf482
X-Google-Attributes: gid1118e6,public
X-Google-Thread: 103c8d,34922ce457bf482
X-Google-Attributes: gid103c8d,public
X-Google-Thread: 114592,34922ce457bf482
X-Google-Attributes: gid114592,public
X-Google-Thread: 109fba,34922ce457bf482
X-Google-Attributes: gid109fba,public
From: David Harmon <source@netcom.com>
Subject: Re: Reading Binary or Hex Data from a File
Date: 2000/02/03
Message-ID: <389f8202.7379027@nntp.ix.netcom.com>
X-Deja-AN: 581430911
Content-Transfer-Encoding: 7bit
References: <s9knkid5dh169@corp.supernews.com>
Organization: RKBA!
X-Server-Date: 4 Feb 2000 07:54:31 GMT
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Newsgroups: alt.comp.lang.learn.c-c++,borland.public.cppbuilder.language,borland.public.cppbuilder.vcl,comp.lang.c++