Reading bytes from a text file that has the form of machine code in C?
- by rashid
I have a text file with machine code in this form:
B2 0A 05
B2 1A 01
B3 08 00 17
B2 09 18
where an instruction has this format:
OP Mode Operand
Note: Operand could be 1 or 2 bytes.
Where:(example)
OP = B2
Mode = 0A
Operand = 05
How can I read the bytes in a variable? As shown in the above example.
When i read the file I get individual characters. I have an array of pointers where I read individual line, but still cannot solve the problem of reading a byte.
Any ideas,suggestions.
I hope I am not confusing anyone here.
Thank you.