Writing a hex editor? What do I need to know?
#1
Posted 08 August 2012 - 11:04 PM
#2
Posted 09 August 2012 - 05:12 AM
#3
Posted 09 August 2012 - 05:40 AM
#4
Posted 14 August 2012 - 10:16 AM
EXOGGEDDEN, on 09 August 2012 - 05:12 AM, said:
Wouldn't it be easier to load the file into an array, especially if it is a larger file?
#5
Posted 15 August 2012 - 07:52 AM
Travelsonic, on 14 August 2012 - 10:16 AM, said:
EXOGGEDDEN, on 09 August 2012 - 05:12 AM, said:
Wouldn't it be easier to load the file into an array, especially if it is a larger file?
That's really what I meant, I just wasn't as explicit about it ;p
#6
Posted 15 August 2012 - 09:36 AM
EXOGGEDDEN, on 15 August 2012 - 07:52 AM, said:
Travelsonic, on 14 August 2012 - 10:16 AM, said:
EXOGGEDDEN, on 09 August 2012 - 05:12 AM, said:
Wouldn't it be easier to load the file into an array, especially if it is a larger file?
That's really what I meant, I just wasn't as explicit about it ;p
Considering that in using ifstream to load a file in binary mode you can work with individual bytes in the form of integers or characters, is conversion using itoa really necessary if you're working with a file that has ASCII text? ASCII would still be read/displayed properly[ASCII being a byte per character]
#7
Posted 15 August 2012 - 10:09 AM
Travelsonic, on 15 August 2012 - 09:36 AM, said:
EXOGGEDDEN, on 15 August 2012 - 07:52 AM, said:
Travelsonic, on 14 August 2012 - 10:16 AM, said:
EXOGGEDDEN, on 09 August 2012 - 05:12 AM, said:
Wouldn't it be easier to load the file into an array, especially if it is a larger file?
That's really what I meant, I just wasn't as explicit about it ;p
Considering that in using ifstream to load a file in binary mode you can work with individual bytes in the form of integers or characters, is conversion using itoa really necessary if you're working with a file that has ASCII text? ASCII would still be read/displayed properly[ASCII being a byte per character]
I wouldn't say that conversion using itoa is absolutely necessary, since it all depends on what you're going to be using. The reason why I mentioned itoa is because I figured that since the bytes will ultimately be displayed on a hex editor, I would assume that the hex editor will be a GUI-based program. To my experience, usually if you want to display numerical data in those you'd have to convert the data to a string or something first, though I would guess this also depends on the API you're going to be using (I just haven't come across one yet that just allowed me to directly display numerical data without having to convert it first.) As for the ASCII text, I'm not really sure what you're trying to say. If I understand you correctly, all hex editors I've seen usually show the bytes' values and then their ASCII representations on the right (which is quite simple to figure out how to do.) The bytes' values are not the same thing as what ASCII character they represent.
#8
Posted 17 August 2012 - 10:50 AM
EXOGGEDDEN, on 15 August 2012 - 10:09 AM, said:
Travelsonic, on 15 August 2012 - 09:36 AM, said:
EXOGGEDDEN, on 15 August 2012 - 07:52 AM, said:
Travelsonic, on 14 August 2012 - 10:16 AM, said:
EXOGGEDDEN, on 09 August 2012 - 05:12 AM, said:
Wouldn't it be easier to load the file into an array, especially if it is a larger file?
That's really what I meant, I just wasn't as explicit about it ;p
Considering that in using ifstream to load a file in binary mode you can work with individual bytes in the form of integers or characters, is conversion using itoa really necessary if you're working with a file that has ASCII text? ASCII would still be read/displayed properly[ASCII being a byte per character]
I wouldn't say that conversion using itoa is absolutely necessary, since it all depends on what you're going to be using. The reason why I mentioned itoa is because I figured that since the bytes will ultimately be displayed on a hex editor, I would assume that the hex editor will be a GUI-based program. To my experience, usually if you want to display numerical data in those you'd have to convert the data to a string or something first, though I would guess this also depends on the API you're going to be using (I just haven't come across one yet that just allowed me to directly display numerical data without having to convert it first.) As for the ASCII text, I'm not really sure what you're trying to say. If I understand you correctly, all hex editors I've seen usually show the bytes' values and then their ASCII representations on the right (which is quite simple to figure out how to do.) The bytes' values are not the same thing as what ASCII character they represent.
I guess I'm just confused about doing the conversion.

01