Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

reading and analyzing binary data from a file

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why adding test code changes the build ? 11 132
How to create frequencies of a variable from SAS dataset? 10 133
Need example 5 122
How to creat good software interface ? 1 67
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
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…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

809 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