Solved

reading and analyzing binary data from a file

Posted on 1998-10-23
3
193 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

New! My Passport Wireless Pro Wi-Fi Mobile Storage

Portable wireless storage to offload, edit, and stream anywhere.

High-capacity, wireless mobile storage designed to accompany professional photographers and videographers in the field to easily offload, edit and stream captured photos and high-definition videos.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to design, and implement simple interface 5 134
How to set environment variables in C 2 78
Handling string inputs in C/Linux 23 179
why "." vs "->" 23 119
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now