Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I open and rewrite a file which is any format.
Message
From
22/04/2003 22:50:14
 
 
To
21/04/2003 02:12:32
Liam O'Hagan
O'Hagan Programming Ltd
Ireland
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00779073
Message ID:
00780440
Views:
15
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform