home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / msdos / programm / 8018 < prev    next >
Encoding:
Text File  |  1992-07-22  |  1.6 KB  |  49 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!ftpbox!motsrd!white!rtsg.mot.com!lido16!wiegand
  3. From: wiegand@rtsg.mot.com (Robert Wiegand)
  4. Subject: Re: Help reading a DOS file
  5. Message-ID: <wiegand.711831277@lido16>
  6. Sender: news@rtsg.mot.com
  7. Nntp-Posting-Host: lido16
  8. Reply-To: motcid!wiegand@uunet.uu.net
  9. Organization: Motorola Inc., Cellular Infrastructure Group
  10. References: <DAO.92Jul22104319@d62iggy.mitre.org>
  11. Distribution: comp.os.msdos.programmer
  12. Date: Wed, 22 Jul 1992 18:54:37 GMT
  13. Lines: 34
  14.  
  15. dao@d62iggy.mitre.org (David A. Ondzes) writes:
  16.  
  17.  
  18. >I need some help. One of my games writes it data to a file, and I would
  19. >like to read this file. When I type the file to the screen it shows up
  20. >as a bunch of happy faces etc ... so I am assuming it is a binary file.
  21. >Is this correct assumption ? I can make out some text in the file. I have
  22. >looked at the file with various hex edit programs to find out where the data
  23. >I want is.
  24. >    How do I read in the data ? I tried using fscanf(fd,"%x",&int). I would
  25. >like to be able to read in 2 hex digits at a time, because this is how I
  26. >saw the file with the hex editors mentioned above.
  27.  
  28. >    Any help involing reading files that are not ascii text would also
  29. >be appreciated.
  30.  
  31.  
  32. >Please send replys to 
  33. >picasso@bass.bu.edu
  34.  
  35.  
  36. >Thank you
  37. >David Ondzes
  38.  
  39. First, make sure you open the file with a file type of "binary" not "text".
  40. Second, try using "fgetc" to read the file a byte at a time.
  41.  
  42.  
  43. -- 
  44. ------------------------------------------------------------------------------
  45. Robert Wiegand - Motorola Inc.
  46. uunet!motcid!wiegand
  47. Disclamer: I didn't do it - I was somewhere else at the time.
  48.