[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: problems with fh:read() correction
- From: Christian Vogler <cvogler@...>
- Date: Sat, 23 Nov 2002 08:27:39 -0500
On Sat, Nov 23, 2002 at 02:08:18PM +0100, Markus Huber wrote:
> fh:write("Jkl") --> File should be AbcJklGhi
> --> Filepointer ^
> print(fh:read("*a")) --> should print Ghi but returns an empty string
A seek or flush is mandatory every time that you switch between reads
and writes (K&R "The C programming language" 2nd edition, Section
B1.1., page 242). See also man fopen on Linux.
I am willing to bet hard money that inserting a seek or a flush after
the write of "Jkl" will solve your problems.