Sign in to follow this  
Followers 0
Frozenyam

New file line count script UDF

5 posts in this topic

#1 ·  Posted (edited)

#Include-Once

Func _CountLines (ByRef $File)
   Global $Count = 0

   FileOpen ($File, 0)

   Do
      $Count = $Count + 1
      $CountLine = FileReadLine ($File, $Count)
   Until @Error = -1

   Return $Count - 1
EndFunc

Will count the lines in a file without problems and will output it to a variable.

Use Of Function:

#Include <_CountLines.au3>

$File = "Path\Name.Extention"
$NumOfLines = _CountLines ($File)

_CountLines.au3

Edited by Frozenyam

"... and the Lord said to John, "Come forth and ye shall receive eternal life," but instead John came fifth and won a toaster."

Share this post


Link to post
Share on other sites



#Include-Once

Func _CountLines (ByRef $File)
   Global $Count = 0

   FileOpen ($File, 0)

   Do
      $Count = $Count + 1
      $CountLine = FileReadLine ($File, $Count)
   Until @Error = -1

   Return $Count - 1
EndFunc

Will count the lines in a file without problems and will output it to a variable.

Use Of Function:

#Include <_CountLines.au3>

$File = "Path\Name.Extention"
$NumOfLines = _CountLines ($File)

<{POST_SNAPBACK}>

Nice try, but too late. This function was improved by Tylo, and included in the standard UDF. >> File.au3 <<

To improve your code, look the w0uter remarks also.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Frozenyam PMed me with this update and i mentioned the same, but he claimed that the current version is broken.

Its better to report the BUG when current UDF's don't work then to come up with a modified version, because this gives the original author of a UDF to fix or update the UDF.

:whistle:

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Frozenyam PMed me with this update and i mentioned the same, but he claimed that the current version is broken.

Its better to report the BUG when current UDF's don't work then to come up with a modified version, because this give the original writer of a UDF to fix or update the UDF.

:whistle:

<{POST_SNAPBACK}>

http://www.autoitscript.com/fileman/users/Josbe/_sforum/smilies/yes.gif I agree completely.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0