-
hex writing stuff
hello,
I got this offset in a file "0X000626C5".
the original hex number is 28 and i want to change it to 27, my only problem is how do i write it in c++ :confused:
i tryd google and search function on this forum,
if any1 can help me thx, gamer.
edit:
is this possible in dev-cpp or should i use vc 2003'?
-
Roughly speaking, you
- open the file for update
- seek to offset 0x626c5
- write a single char
Something like this (you can look up the details from here)
f.open("file");
f.seek(0x626c5);
f.putc(27);
-
so basicly with seek you can just find the location of the offset?
quickedit:
so i can do the same with f.seek to get what is there currently
-
> so i can do the same with f.seek to get what is there currently
Yes, if you consider a file as an array of characters, then seek is the subscripting operator, and getc() and putc() are the access functions.
array[10] = 2;
file.seek(10);file.putc(2);
One trap to watch for is that with a file you should use flush() following a write operation, especially if you intend to follow on with some read operations.