Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Text file returning incorrect no.of.lines
Message
De
13/06/2002 06:44:28
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
13/06/2002 06:39:00
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00667588
Message ID:
00667823
Vues:
22
>>Hello all
>>
>>I have a text file with 7 lines and 8th line is blank when i issue
>>lcFile=Filetostr(cfile)
>>numLines=Alines(aTextArray,lcFile)
>>
>>i get numlines as 8 how to get it to 7
>>
>>txs
>
>Alines counts CRLF or LF and trim() doesn't trim CRLF chars. Below code assumes linecount is not over array limit and returns result eliminating blank lines at top, between lines or at end.
>
>
>lnLines = alines(arrLines,FileToStr('myFile.txt'))
>TotLines = lnLines
>for ix=1 to lnLines
>  if trim(arrLines[ix])==''
>    TotLines = TotLines - 1
>  endif
>endfor
>? TotLines
Cetin

In another branch of this thread you give a sample that looks like your intention is to process an SDF file. If so you don't even need to count nonempty lines and directly do it in your 'append from..' code. Assuming one of your fields should never be empty (a key maybe) and named myField you could do this :

append from myText.txt type SDF for !empty(myField)

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform