Re: delete bytes?

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

> I have a text file open and I want to write a few words after the 25th by=
te and delete the rest. What should I do?

its only 25 bytes, why not do this?

include get.e
include file.e

integer fn
sequence bytes

-- open file for reading
fn = open("mytext.txt", "r")
-- buffer the data
bytes = get_bytes(fn, 25)
-- close file
close(fn)

-- open file for writing
fn = open("mytext.txt", "w")
-- output buffer
puts(fn, bytes)
-- output our data
puts(fn,"Aha!\n")
-- close the file
close(fn)


~Greg

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

Search



Quick Links

User menu

Not signed in.

Misc Menu