🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #435

Re: Help reading a DOS file

#435
From: Robert Wiegand
Date: Wed, 22 Jul 1992 18:54
34 lines
1691 bytes
dao@d62iggy.mitre.org (David A. Ondzes) writes:


>I need some help. One of my games writes it data to a file, and I would
>like to read this file. When I type the file to the screen it shows up
>as a bunch of happy faces etc ... so I am assuming it is a binary file.
>Is this correct assumption ? I can make out some text in the file. I have
>looked at the file with various hex edit programs to find out where the data
>I want is.
> 
>	How do I read in the data ? I tried using fscanf(fd,"%x",&int). I would
>like to be able to read in 2 hex digits at a time, because this is how I
>saw the file with the hex editors mentioned above.

>	Any help involing reading files that are not ascii text would also
>be appreciated.


>Please send replys to 
>picasso@bass.bu.edu


>Thank you
>David Ondzes

First, make sure you open the file with a file type of "binary" not "text".
Second, try using "fgetc" to read the file a byte at a time.


-- 
------------------------------------------------------------------------------
Robert Wiegand - Motorola Inc.
uunet!motcid!wiegand
Disclamer: I didn't do it - I was somewhere else at the time.
Technical Details
Message-ID: <wiegand.711831277@lido16>
Path: arc1-ca.pugleaf.net!sparky!uunet!ftpbox!motsrd!white!rtsg.mot.com!lido16!wiegand
References: <DAO.92Jul22104319@d62iggy.mitre.org>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!ftpbox!motsrd!white!rtsg.mot.com!lido16!wiegand
From: wiegand@rtsg.mot.com (Robert Wiegand)
Subject: Re: Help reading a DOS file
Message-ID: <wiegand.711831277@lido16>
Sender: news@rtsg.mot.com
Nntp-Posting-Host: lido16
Reply-To: motcid!wiegand@uunet.uu.net
Organization: Motorola Inc., Cellular Infrastructure Group
References: <DAO.92Jul22104319@d62iggy.mitre.org>
Distribution: comp.os.msdos.programmer
Date: Wed, 22 Jul 1992 18:54:37 GMT
Lines: 34