Re: delete bytes?

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

Salix wrote:

> I have a text file open and I want to write a few words after the 25th byte
> and delete the rest. What should I do?
> 
> }}}
<eucode>
> include file.e
> 
> integer fn, fx
> fn = open("mytext.txt", "u")
> fx = seek(fn, 25)
> puts(fn,"Aha!\n")
> -- ... and now what?
> </eucode>
{{{


In BASIC it was/is possible to clip a file by writing zero bytes (not
a byte with value 0) at the desired end of the file. For details see
this book, now free in electronic form:
     http://www.ethanwiner.com/WINER.ZIP
Then in "Chap11.txt", look for the procedure ClipFile().

Some time ago I had tried to do the same with Euphoria, using
     puts(fn, "")
Unfortunately, without success.

Maybe this is possible with Euphoria by calling a DOS interrupt or
a Windows/Linux API function.

Regards,
   Juergen

-- 
Have you read a good program lately?

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

Search



Quick Links

User menu

Not signed in.

Misc Menu