Solved

reading and analyzing binary data from a file

Posted on 1998-10-23
3
205 Views
Last Modified: 2010-04-15
I am trying to read a binary file and do some analysis of the information contained.  I am using fread(name,4,1,fp) where name is a char[4], name is supposed to receive whatever I read in, but I can't make sense of what is read in.  Can someone help me read this information in and analyze it?
Thanks
0
Comment
Question by:curtisn
3 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1253787
what's in the file?  what's the format of the file?  what did you find in name?
0
 

Accepted Solution

by:
dynasoft earned 100 total points
ID: 1253788
A. Start by creating a simple test file that contains something like "ABCD" and use that file to test your code.

B. Use your debugger if you can to inspect the name[] string after the fread().  If you can't use your debugger, please specify what compiler and operating system you are using and I will try to help further.

C. If the above test doesn't work, give me a sample of the code starting with the fopen().  By the way are you opening the file in binary mode?

D. If the test does work, let me know what you are trying to analyze or accomplish if you need further assistance.

If you would prefer private tutoring, please email me at dynasoft@juno.com

0
 

Author Comment

by:curtisn
ID: 1253789
I was able to figure the problem and it wasn't a coding error.  I was using Visual C++ 6.0 and for some reason, the debugger couldn't show what was in the variables, I could see it in memory but it wasn't shown by the memory.

I changed to UNIX and was able to see the contents of the variables clearly,

thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question