unlink and rename functions for Linux exu
All,
I have the following two functions for unlinking and renaming files with the
exw.exe Windows interpreter. Can I do a similar thing with the exu Linux
interpreter?
-------------------------------------------------------------
function unlink_win(sequence filename)
atom kernel32
atom deletefile
atom a
atom r
kernel32 = open_dll("kernel32.dll")
if kernel32 = 0 then
return(-1)
end if
deletefile = define_c_func(kernel32, "DeleteFileA", {C_POINTER}, C_INT)
if deletefile = -1 then
return(-1)
end if
a = allocate_string(filename)
r = c_func(deletefile, {a})
free(a)
if r != 1 then
return(-1)
end if
return(0)
end function
function rename_win(sequence oldname, sequence newname)
atom kernel32
atom movefile
atom old
atom new
atom r
kernel32 = open_dll("kernel32.dll")
if kernel32 = 0 then
return(-1)
end if
movefile = define_c_func(kernel32, "MoveFileA", {C_POINTER, C_POINTER},
C_INT)
if movefile = -1 then
return(-1)
end if
old = allocate_string(oldname)
new = allocate_string(newname)
r = c_func(movefile, {old, new})
free(old)
free(new)
if r != 1 then
return(-1)
end if
return(0)
end function
Regards,
FP.
|
Not Categorized, Please Help
|
|