Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help on FileToStr() and ChrTran() functions
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00505649
Message ID:
00505918
Vues:
27
>Nadya,
>
>(once again with the right tag_
>
>I'm quite positive I was using VFP6. The string limit is only available memory. I ran the code on a 256MB NT4 machine. The file size was 39,452,096 bytes long.
>
>
lcStr = filetostr( "TheBad.csv" )
>
>i = 0
>
>FixIt( chr(10) + ",", " ," )
>FixIt( [,] + chr(10), " ," )
>FixIt( " " + chr(10), "  " )
>FixIt( chr(10) + " ", "  " )
>
>FixIt( chr(10) + chr(10), "  " )
>
>FixIt( chr(13) + " ", "  " )
>FixIt( chr(13) + ",", " ," )
>
>? "write", datetime()
>strtofile( lcStr, "TheGood.csv" )
>? "done", datetime()
>
>function FixIt( pcSearch, pcFix )
>i = i + 1
>? "convert", i, datetime()
>lcStr = strtran( lcStr, pcSearch, pcFix )
>return
>
>To test the size of strings you can run this code (I wouldn't do it on a 64MB machine unless you have lots and lots of time to wait for virtual memory swaps)

I have 192MB. Should I try?

>
>
lcStr = "1234567890"
>for i = 1 to 20
>  lcStr = lcStr + lcStr
>endfor
>
>for i = 1 to 5
>   strtofile( lcStr, "c:\temp\bigfile.txt", .t. )
>endfor
>
>lcStr = filetostr( "c:\temp\bigfile.txt" )
>? datetime(), len( lcStr )
>? datetime(), occurs( '0', lcStr )
>lcStr = chrtran( lcStr, '0', 'a' )
>? datetime(), occurs( 'a', lcStr )
>
>This creates a 51mb string and changes 5.2 million 0s to a and counts them in about 10 seconds on my machine.
>
>>Could you show some code content? Are you sure, you used it in VFP6.0? I thought, the string limit in VFP6 is 16MB (I believe, John Koziol told me this limit while ago).
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform