Reading bytes from a text file that has the form of machine code in C?
Posted
by rashid
on Stack Overflow
See other posts from Stack Overflow
or by rashid
Published on 2010-04-27T18:32:36Z
Indexed on
2010/04/27
18:33 UTC
Read the original article
Hit count: 201
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.
© Stack Overflow or respective owner