lua-users home
lua-l archive

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


I'm new enough to this, that I might be missing something, but this can be done in the main code of Lua as supplied. I'm using Windows. I was warned to be careful about btye order but this is working and not a problem for me.

These are the two functions I've worked out for handling save amd load of binary files:

function DataLoad(F)                                                    
    F=assert(io.open(F,"rb"))  local D=F:read("*a")  F:close()  return D
end                                                                     
                                                                        
function DataSave(F,D)                                                  
    F=assert(io.open(F,"wb"))  F:write(D)  F:close()                    
end                                                                     

If it's this easy, why add a special library to what's already there?


"Danilo Tuler" <tuler@pobox.com> wrote:
(31/08/2004 22:44)

>
>Hi,
>
>I need an IO lib specifically for Windows, which uses the windows file
>management functions.
>The list below shows the mapping I would do:
>
>FILE* -> HANDLE
>fopen -> CreateFile
>fread -> ReadFile
>fwrite -> WriteFile
>tmpfile -> GetTempFileName + CreateFile
>fclose -> CloseHandle
>
>Is this already done?
>
>Thanks,
>Danilo