hey there everyone
i was working on a program of mine when that should read the file in hex and display the value of a certain hex address (0x000068FC as example).

but i have no clue where to begin except that ppl say it should work with fseek & fread
ive tried but i can't seem to work with it.
anyone might wanna help me with this?

thx
Daco

Recommended Answers

All 7 Replies

post what you have tried. And post an example data file.

i didn't post code cause i knew i was totally wrong >_<

FILE *pFile;
char* buffer;
pFile = fopen("file.raw","rb");
//ill use the example address from original post
if(fseek(pFile, 0x000068FC, SEEK_SET)) 
{
//the 2 means to read 2 bytes right?
     fread(buffer,1,2,pFile);
fread(memory_card_content, 1, memory_card_size, pFile);
}
// final check to see what value buffer contains using command PanicAlert
PanicAlert("buffer = %x or %c",buffer,buffer");

Also please post actual text of the assignment, not how you interpreted it.

this is the file it should read in the code.
if that is what you mean

That wasn't what I meant -- There must have been more the the instructions your teacher gave you what what you posted because what you posted doesn't make any sense. Post exactly the words given to you.

i dont follow coding classes. im doing this on my own.

ill explain all over again
when you hex edit a file you have a certain value on a certain address
for example you have value 04 on address 0x000068FC
my question was how do i check if hex address 0x000068FC has 04 as value

where did you get that address from? 68FCH == 26876 decimal. If that's the byte offset in the file where that value is found, then you should be able to just seek to that position and read that byte.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.