Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help on FileToStr() and ChrTran() functions
Message
De
10/05/2001 09:09:44
 
 
À
10/05/2001 05:35:12
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00505649
Message ID:
00505711
Vues:
21
>Hi
>
>I'm using these commands to get rid of the double quotes in a text flat file. The code works accept when the file contains more than +/- 2000 records (lines) the vfox session hangs (NOT RESPONDING). Is there a limit or do I need to include in my code a command that tells vfox to wait until the FileToStr command is done? Please help...
>
>The command that causes the programto hang is:
>StrToFile(chrtran(FileToStr('c:\tmp\wtbsold.txt'),'"',''),'c:\tmp\wtbsold.txt')
>
>Thank you
>
>Irene Grassow

&& On a big file it could be a memory issue, but not if you read it one line at the time
lnFileHandle=FOPEN(lcFile)				&& Try to open the file
IF lnFileHandle >0					&& File opened ok
	lnEOF=FSEEK(lnFileHandle, 0, 2)			&& Move pointer to EOF
	lnBOF=FSEEK(lnFileHandle, 0)			&& Move pointer to BOF
	IF lnEOF > 0                                    && The file is not empty  								
		lnWriteFile = FCREATE('MyFile.txt')  	&& Create a file to write to
		&& Check here if that went ok?
		DO WHILE !FEOF(lnFileHandle)
			lcTranString=CHRTRAN(FGETS(lnFileHandle,8192),'"','')
			lnResult=FPUTS(lnWriteFile, lcTranString)
			&& I can't for the life of me remeber if you have to move the pointer to EOF
			&& after FPUTS, but I guess not.
		ENDDO
		=FCLOSE(lnFileHandle)
		=FCLOSE(lnWriteFile)
	ENDIF
ENDIF
Peter Pirker


Whosoever shall not fall by the sword or by famine, shall fall by pestilence, so why bother shaving?

(Woody Allen)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform