Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

reading and analyzing binary data from a file

Posted on 1998-10-23
3
Medium Priority
?
236 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 85

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 400 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
Suggested Courses

972 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