Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I open and rewrite a file which is any format.
Message
De
22/04/2003 22:50:14
 
 
À
21/04/2003 02:12:32
Liam O'Hagan
O'Hagan Programming Ltd
Irlande
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00779073
Message ID:
00780440
Vues:
13
Hi all
I do not want to copy the file. I want to open file and replace a string on it and rewrite new content of the file.

for following example , MS Excel cannot open new file.
****************************
STORE FOPEN('Excel.xls') TO gnFileHandle && Open the file

STORE FSEEK(gnFileHandle, 0, 2) TO gnEnd && Move pointer to EOF
STORE FSEEK(gnFileHandle, 0) TO gnTop && Move pointer to BOF
IF gnEnd <= 0 && Is file empty?
WAIT WINDOW 'This file is empty!' NOWAIT
ELSE && If not
gcString = FGETS(gnFileHandle, gnEnd) && Store contents
gcString= STRTRAN(gcString,"original string", "new string")
gnIOBytes = FWRITE(gnFileHandle,' for low-level file I/O')
glFlushOk = FFLUSH(gnFileHandle)
glCloseOk = FCLOSE(gnFileHandle)
*******************************************

Regard
Canh
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform