$lines » History » Version 1
Per Amundsen, 07/07/2014 02:41 PM
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ |
|---|---|---|---|
| 2 | |||
| 3 | *$lines(filename)* |
||
| 4 | |||
| 5 | Returns the total number of lines in the specified text file. |
||
| 6 | |||
| 7 | *Parameters* |
||
| 8 | |||
| 9 | filename - Filename to read from. |
||
| 10 | |||
| 11 | *Example* |
||
| 12 | |||
| 13 | <pre> |
||
| 14 | ;Open a file for writing |
||
| 15 | /fopen file file.txt |
||
| 16 | |||
| 17 | ;Write a line to the file |
||
| 18 | /fwrite file Hello World |
||
| 19 | |||
| 20 | ;Close the file |
||
| 21 | /fclose file |
||
| 22 | |||
| 23 | ;Print the number of lines in file.txt |
||
| 24 | //echo -ag $lines(file.txt) |
||
| 25 | <pre> |