| | |
reading a file in hex
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2007
Posts: 13
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Jun 2007
Posts: 13
Reputation:
Solved Threads: 0
i didn't post code cause i knew i was totally wrong >_<
C++ Syntax (Toggle Plain Text)
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");
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
- Reading Binary Files in VB (Visual Basic 4 / 5 / 6)
- reading a text file and searching for a sentence (C++)
- Reading the first four bytes of a (binary) files? (VB.NET)
- Anyone can help?? (C++)
- Reading/Writing to Executable (C++)
- reading from a file with python (Python)
- reading a file into code (Java)
Other Threads in the C++ Forum
- Previous Thread: Displaying comma in .csv fille
- Next Thread: resize control
| Thread Tools | Search this Thread |
api array based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock wordfrequency wxwidgets






