Re: Writing data to an offset

new topic     » goto parent     » topic index » view thread      » older message » newer message

Andreas wrote:
> How do  in a windows program you write a value (size of one byte) to
> a specific offset i a binary file using euphoria? for an example i would
> like to write the value 5D to offset 78C7F.
> can someone give me a small example program? (all numbers are in hexadecimal).

This should do it (not tested, as usual ;)

---------------------
include file.e
integer fn

fn = open("myfile", "ub")

if seek(fn, #78C7F) != 0 then
    puts(2, "Seek failed!\n")
    abort(1)
end if
puts(fn, #5D)
close(fn)
---------------------


Regards,
      Martin Stachon

martin.stachon at tiscali.cz
http://www.webpark.cz/stachon

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu