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:39:00
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
12/06/2002 15:08:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00667588
Message ID:
00667821
Vues:
18
This message has been marked as the solution to the initial question of the thread.
>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
Ç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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform