1. Writing data to an offset

This is a multi-part message in MIME format.

------=_NextPart_000_0014_01C2358F.0DA35A80
	charset="iso-8859-1"

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).

Andreas

------=_NextPart_000_0014_01C2358F.0DA35A80
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>How do&nbsp; in a windows program you =
write a value=20
(size of one byte) to a specific offset i a binary file using euphoria? =
for an=20
example i would like to write the value 5D to offset 78C7F.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>can someone give me a =
small&nbsp;example program?=20
(all numbers are in hexadecimal).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>

------=_NextPart_000_0014_01C2358F.0DA35A80--

new topic     » topic index » view message » categorize

2. Re: Writing data to an offset

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 message » categorize

3. Re: Writing data to an offset

this worked.
Thank you!


----- Original Message -----=20
From: "Martin Stachon" <martin.stachon at worldonline.cz>
To: "EUforum" <EUforum at topica.com>
Subject: Re: Writing data to an offset


>=20
> 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).
>=20
> This should do it (not tested, as usual ;)
>=20
> ---------------------
> include file.e
> integer fn
>=20
> fn =3D open("myfile", "ub")
>=20
> if seek(fn, #78C7F) !=3D 0 then
>     puts(2, "Seek failed!\n")
>     abort(1)
> end if
> puts(fn, #5D)
> close(fn)
> ---------------------
>=20
>=20
> Regards,
>       Martin Stachon
>=20
> martin.stachon at tiscali.cz
> http://www.webpark.cz/stachon
>=20
> =
>=20
>=20
> =
>=20

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu