FILECOPY will overwrite file as documented, but raises ERR=75, am I doing something wrong, or .. ?
Any help would be appreciated.
' FILECOPY raises error if DestFile exist (even if not read-only)
' To test example, create simple textfile c:\Temp\test_s.txt
' 1:st time executed, when sDestFile doesn't exist, everything goes OK
' 2:nd time executed when sDestFile exist
' , file is copied but ERR 75 Path/File ACCESS error is raised, why ?
$COMPILE EXE
FUNCTION WINMAIN (BYVAL CurInst AS LONG, _
BYVAL PrvInst AS LONG, _
CmdLine AS ASCIIZ PTR, _
BYVAL CmdShow AS LONG) EXPORT AS LONG
DIM sSourceFile AS STRING
DIM sDestFile AS STRING
ON ERROR GOTO WinMain_Err
sSourceFile = "c:\temp\test_s.txt"
sDestFile = "c:\temp\test_d.txt"
FILECOPY sSourceFile, sDestFile ' Copies sSourceFile but raises ERR=75 Path/File Access error
' if sDestFile exist
MSGBOX "FILECOPY was OK"
WinMain_Exit:
EXIT FUNCTION
WinMain_Err:
MSGBOX "Error code = " & STR$(ERRCLEAR)
RESUME WinMain_Exit
END FUNCTION
Any help would be appreciated.
' FILECOPY raises error if DestFile exist (even if not read-only)
' To test example, create simple textfile c:\Temp\test_s.txt
' 1:st time executed, when sDestFile doesn't exist, everything goes OK
' 2:nd time executed when sDestFile exist
' , file is copied but ERR 75 Path/File ACCESS error is raised, why ?
$COMPILE EXE
FUNCTION WINMAIN (BYVAL CurInst AS LONG, _
BYVAL PrvInst AS LONG, _
CmdLine AS ASCIIZ PTR, _
BYVAL CmdShow AS LONG) EXPORT AS LONG
DIM sSourceFile AS STRING
DIM sDestFile AS STRING
ON ERROR GOTO WinMain_Err
sSourceFile = "c:\temp\test_s.txt"
sDestFile = "c:\temp\test_d.txt"
FILECOPY sSourceFile, sDestFile ' Copies sSourceFile but raises ERR=75 Path/File Access error
' if sDestFile exist
MSGBOX "FILECOPY was OK"
WinMain_Exit:
EXIT FUNCTION
WinMain_Err:
MSGBOX "Error code = " & STR$(ERRCLEAR)
RESUME WinMain_Exit
END FUNCTION
Comment