Hi Pierre,
Function FOPEN() only open existed file. FOPEN( ) returns –1 if the file cannot be opened. If yo wont to create file use FCREATE().
Do something like this:
p_path="c:\temp\"
IF FILE(p_path+'temp.txt') && Does file exist?
gnErrFile = FOPEN(p_path+'temp.txt',11) && If so, open write only
ELSE
gnErrFile = FCREATE(p_path+'temp.txt') && If not, create it
ENDIF
IF gnErrFile < 0 && Check for error opening file
WAIT 'Cannot open or create output file' WINDOW NOWAIT
ELSE && If no error, write to file
=FWRITE(gnErrFile, 'Error information to be written here')
ENDIF
=FCLOSE(gnErrFile) && Close file
Regards Milan
Slosiar Milan
www.martimex.com