Re: Printing fopen

From: Date: Fri, 28 Sep 2001 01:38:19 +0000
Subject: Re: Printing fopen
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-69085@lists.php.net to get a copy of this message
On Fri, 28 Sep 2001 10:58, Devon wrote: > $fp = fopen ("http://localhost/Install.txt", > "r"); > > Once the file is open how do I print it out? And also is it possible > to print it out line bye line? Today's popular topic will be reading files and manipulating them. From the docs fpassthru (PHP 3, PHP 4 >= 4.0.0) Output all remaining data on a file pointer int fpassthru (int fp) Reads to EOF on the given file pointer and writes the results to standard output. If an error occurs, fpassthru() returns FALSE. The file pointer must be valid, and must point to a file successfully opened by fopen(), popen(), or fsockopen(). The file is closed when fpassthru() is done reading it (leaving fp useless). If you just want to dump the contents of a file to stdout you may want to use the readfile(), which saves you the fopen() call. See also readfile(), fopen(), popen(), and fsockopen() There is a lot more information in the 'filesystem' section of the manual. In particular, file() wil load the contents of a file into an array, one line per element; you can then deal with each line separately. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Despite the high cost of living, it remains popular.

« previous php.general (#69085) next »