Re: 3.0.3 Release Candidate for Windows/DOS

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

Hi

Rough draft

integer fp, count, desired_length
sequence buffer
object c

buffer = {}
count = 0
desired_length = 2000
open("Filename.ext", "r"

while 1 do
    c = getc(fp)
    if c = -1 then exit end if  --end of file
    if count > desired_length then exit end if -- desired_length exceeded
    buffer = append(buffer,c)
    count += 1
end while

close(fp)

fp = open("newfile.ext","w")
puts(fp, buffer)
close(fp)


Not tested, but I do stuff like that quite frequently. (and may well not be the
most efficient way of doing it)

Chris


http://euallegro.wikispaces.com
http://members.aol.com/chriscrylex/euphoria.htm
http://uboard.proboards32.com/
http://members.aol.com/chriscrylex/EUSQLite/eusql.html

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

Search



Quick Links

User menu

Not signed in.

Misc Menu