lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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.

Regards
- Christian