Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Macro Expansion
Message
De
09/01/2002 08:04:08
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
09/01/2002 07:59:47
John Marrone
Bloodstock Research Inc.
Lexington, Kentucky, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00602412
Message ID:
00602439
Vues:
40
>I did use alines, and it works fine 95% of the time. Its the 5% of the
>time that is killing me. For some reason about every 20th record it loses
>a field or two. I don't know if it is because each record has so many fields
>in it (1435). Here the code using Alines().
>
>DIMENSION aAr(1435)
>vcStr = FGETS(nHandle, 8192)
>vnRecCnt = ALINES(aAr, CHRTRAN(CHRTRAN(vcStr, ["], ""), ",", CHR(13)))
>
>This will work but then it just messes up after so many records?? Plus ALines()
>makes every element a string, so u have to use VAL() to store it as a numeric.

There are alternatives to alines(). Before knowing alines(), I used a combination of memlines(), mline() and the _mline variable. See samples in help.

Important note: the help says that these functions are for memo fields. In fact, they work for any character expression that might contain several lines.

Also, if what you need is to read data from disk, you can use low-level file functions as an alternative (fopen(), fgets(), fclose()).

alines() is limited to the max. size of an array, i.e., about 32K lines.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform