Re: seek() bug?
Derek Parnell writes:
> I can confirm that there is a bug somewhere in Euphoria's handling of
> puts(), gets(), seek(), and where() when using a file opened for either "u"
> or "ub".
OK, Thanks for the example.
I think I see the problem.
Your code and Kat's code seem to be falling into the little trap
that I mentioned in my previous post:
> 3. The Euphoria manual states:
> "After seeking and reading (writing) a series of bytes, you may
> need to call seek() explicitly before you switch to writing
> (reading) bytes, even though the file position should already be
> what you want."
I discovered this a couple of years ago, and I originally thought it
was due to some kind of bug in Watcom, but it seems to happen
with all the C compilers (tested using the Translator).
I'm not doing much in Euphoria, other than passing the seek
and puts/gets info to the C routines, so it seems to be a quirk in C.
So the rule is: when switching between reading the file and
writing the file, do an explicit seek() to set the file pointer.
I also tried calling flush() and that also works in this case.
Regards,
Rob Craig
Rapid Deployment Software
http://www.RapidEuphoria.com
|
Not Categorized, Please Help
|
|