Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Array to Text File
Message
De
17/08/2006 09:23:40
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01146298
Message ID:
01146343
Vues:
18
>>>Dear all,
>>>
>>>Could anyone suggest me a better solution to change Array Content into a text file
>>>
>>>My approach is Array -> String -> text (I think there is limitation of characters held in string)
>>>
>>>lcMemo = ''
>>>
>>>a_n = 'aLB'
>>>nRow = ALEN(&a_n,1)
>>>
>>>FOR x = 1 TO nRow
>>>	lcMemo = lcMemo + ALLTRIM(&a_n[x])+CHR(13)
>>>ENDFOR
>>>
>>
>>Sergey can fail, and here it fail.
>>
>>STRTOFILE is very slow because it open and close the file every time,
>>don't use it in loop ( best if you remove stars for others readers )
>>
>>use SET TEXTMERGE
>>
>>DIMENSION aLB[10000]
>>
>>lcTextFile = "Temp.txt"
>>
>>
>>CLEAR
>>
>> aLB = REPLICATE('A',10)
>>
>>texttotest()
>>
>>strtest()
>>
>>PROCEDURE strtest
>>
>> ERASE (lcTextFile)
>>	t1 = SECONDS()
>>lcCrLf = CHR(13) + CHR(10)
>> FOR x = 1 TO ALEN(aLB)
>>	STRTOFILE( aLB[x] + lcCrLf, lcTextFile, .T.)
>> ENDFOR
>>    ? "strtofile",SECONDS()-t1
>>
>>ENDPROC
>>
>>PROCEDURE texttotest
>> ERASE (lcTextFile)
>>	t1 = SECONDS()
>>	SET TEXTMERGE TO (lcTextFile) ADDITIVE NOSHOW ON
>>
>>	 FOR x = 1 TO ALEN(aLB)
>>		\\<<aLB[x]>>
>>		\
>>	 ENDFOR
>>	
>>    SET TEXTMERGE TO
>>    ? "textmerge",SECONDS()-t1
>>ENDPROC
>>
>
>Good point.

And if the text file is shared, the destruction is sure.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform