Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FOpen always returns -1 (Can't read or write)
Message
 
À
17/06/1998 07:31:35
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00108985
Message ID:
00109011
Vues:
55
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform