1. Re: 3.0.3 Release Candidate for Windows/DOS -- should have been truncate
- Posted by Chris Burch <chriscrylex at aol.com> May 30, 2007
- 599 views
Chris Burch wrote: > > Hi > > Rough draft > > }}} <eucode> > 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) > > </eucode> {{{ > > Not tested, but I do stuff like that quite frequently. (and may well not be > the most efficient way of doing it) > > Chris > > > <a href="http://euallegro.wikispaces.com">http://euallegro.wikispaces.com</a> > <a > href="http://members.aol.com/chriscrylex/euphoria.htm">http://members.aol.com/chriscrylex/euphoria.htm</a> > <a href="http://uboard.proboards32.com/">http://uboard.proboards32.com/</a> > <a > href="http://members.aol.com/chriscrylex/EUSQLite/eusql.html">http://members.aol.com/chriscrylex/EUSQLite/eusql.html</a> And has the signature length been truncated too? http://euallegro.wikispaces.com http://members.aol.com/chriscrylex/euphoria.htm http://uboard.proboards32.com/ http://members.aol.com/chriscrylex/EUSQLite/eusql.html