"File already exists" despite STATUS='Unknown'

"File already exists" despite STATUS='Unknown'

I have a DLL in CVF 6.6B in which a file.dat is created. This DLL is called by a VB application. In the VB side I check the system error code produced by the call to DLL by Err.LastDllError:

Err.Clear
Call DLL
If Err.LastDllError Then
MsgBox ?.. Err.LastDllError
End If

This returns 183, which according to MSDN means ERROR_ALREADY_EXISTS (Cannot create a file when that file already exists.) This happens only when there is a file.dat, no matter if I open it in the DLL with STATUS=?Unknown? or STATUS=?Replace?. The file is updated and overwritten despite the error. There is no error 183 when I delete the file.dat and run the application.

This has not happened to me before. I wonder if it is a known Win XP ?feature? or a 6.6B ?feature?.

Sabalan.

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

You can only trust the LastError if you in fact have an indication that an error occurred. In many cases, the RTL may do something that gets an error than then uses that information to do something else, as it does in the case of STATUS="UNKNOWN". If the OPEN succeeded, then any LastError information is unpredictable.

Steve

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today