lua-users home
lua-l archive

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


>>>>> "Philippe" == Philippe Lhoste <PhiLho@GMX.net> writes:

    Philippe> On mar. 15 oct. 2002 08:01:48, Gaurav Kumar
    Philippe> <gkumar@students.uiuc.edu> wrote:

    >> I am still in the early stages of learning Lua.  I am using Lua
    >> 3.2. I have this problem, i can read from a file , but cannot
    >> write to it.
    >> 
    >> -- et contains "happy"
    >> 
    >> k = openfile("et","r") print(k) m= read(k,"*l") print(m)
    >> 
    >> it works fine
    >> 
    >> but this does not ?
    >> 
    >> k = openfile("etc","w") print(k) m= write(k,"happy") print(m)
    >> 
    >> though a new file is created it has nothing
    >> 

As others I suggest switching to Lua4 at least.

But when writing files (and this is true in many languages) you need
to either flush or close them to have something in the file system.



-- 

Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
alias: basile<at>tunes<dot>org 
8, rue de la Faïencerie, 92340 Bourg La Reine, France