I have the following code that sometimes returns an error when trying to create a new directory. Sometimes when that directory doesn't exist, it throws an error and does not create the directory. I would like to know why?
DECLARE DYNAMIC LIBRARY "kernel32"
FUNCTION CreateDirectoryA% (F$, X$)
FUNCTION GetLastError& ()
END DECLARE
F$ = "TEMPX" + CHR$(0) ' new directory to create
x = CreateDirectoryA(F$, CHR$(0))
IF x = 0 THEN
IF GetLastError = &H3E6 THEN
PRINT "Invalid access to memory location."
END IF
END IF
This code was written in QB64.