Re: [PHP] How do I read the first n lines from a file?

2001-08-28 Thread Hugh Danaher
000 represents the number of bytes to go to unless it finds "\n" sooner. print "$line"; } I'm prety sure the above will work. Hugh - Original Message - From: Jon Farmer <[EMAIL PROTECTED]> To: Tauntz <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>

RE: [PHP] How do I read the first n lines from a file?

2001-08-28 Thread Jon Farmer
If you are on a unix box you might want to use the tail command... if you use exec() the output will be in an array... -- Jon Farmer Õ?Õ? Systems Programmer, Entanet www.enta.net Tel +44 (0)1952 428969 Mob +44 (0)7968 524175 PGP Key available, send blank email to [EMAIL PROTECTED] -Original

Re: [PHP] How do I read the first n lines from a file?

2001-08-28 Thread Data Driven Design
: (386) 226-8979 Websites That WORK For You - Original Message - From: "Tauntz" <[EMAIL PROTECTED]> To: "php" <[EMAIL PROTECTED]> Sent: Tuesday, August 28, 2001 7:59 AM Subject: Re: [PHP] How do I read the first n lines from a file? > hey.. thank you.. &g

RE: [PHP] How do I read the first n lines from a file?

2001-08-28 Thread Niklas Lampén
the lines in order last, last-1, last-2 Niklas -Original Message- From: Tauntz [mailto:[EMAIL PROTECTED]] Sent: 28. elokuuta 2001 15:00 To: php Subject: Re: [PHP] How do I read the first n lines from a file? hey.. thank you.. but is it possible to read the last lets say 10 lines

Re: [PHP] How do I read the first n lines from a file?

2001-08-28 Thread Tauntz
ust 28, 2001 3:28 PM Subject: RE: [PHP] How do I read the first n lines from a file? > You can do this: > > $i = 0; > $fp = fopen("list.txt", "r"); > while (!feof($fp) && $i < 10) { > $i++; > $Text = fgets($fp, 4096); // Reads first 4096 chara

RE: [PHP] How do I read the first n lines from a file?

2001-08-28 Thread Niklas Lampén
Oops.. Forgot to close the file. Put as last line: fclose($fp); Niklas -Original Message- From: Niklas Lampén [mailto:[EMAIL PROTECTED]] Sent: 28. elokuuta 2001 15:29 To: Tauntz; Php-General Subject: RE: [PHP] How do I read the first n lines from a file? You can do this: $i = 0; $fp

RE: [PHP] How do I read the first n lines from a file?

2001-08-28 Thread Niklas Lampén
You can do this: $i = 0; $fp = fopen("list.txt", "r"); while (!feof($fp) && $i < 10) { $i++; $Text = fgets($fp, 4096); // Reads first 4096 characters from a row. print "$Text\n"; }; Niklas -Original Message- From: Tauntz [mailto:[EMAIL PROTECTED]] Sent: 28. elok