Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29277 Discussions

"File already exists" despite STATUS='Unknown'

Intel_C_Intel
Employee
733 Views
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.
0 Kudos
1 Reply
Steven_L_Intel1
Employee
733 Views
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
0 Kudos
Reply