fopen and while problem
| From: | Dennis Moore | Date: | Fri, 09 Nov 2001 19:14:15 +0000 |
| Subject: | fopen and while problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-74042@lists.php.net to get a copy of this message | ||
I am having problems using the fopen functions within a while loop. I am having problems passing
variables into the function. Has anyone else had this problem?
Example:
$work_dir="$DOCUMENT_ROOT/click/oct01";
$ls_res=system("ls $work_dir/*.html > $work_dir/ls.txt");
$ar_file_list=file("$work_dir/ls.txt");
reset($ar_file_list);
while (list ($key, $val) = each ($ar_file_list)) {
settype($val, "string");
echo "$val<br>";
if (is_writeable($val)) {
$s = stat($val);
$bytes = $s[7];
echo "Bytes: $bytes Exists: $val";
}
$fx = fopen($val, "r");
$text = fread($fx,filesize($val));
$size=filesize($val);
echo "$size - $text <hr>";
fclose($fx);
}
Configure Command:
'./configure' '--with-apache=/u1/source/apache_1.3.20'
'--with-zlib=/usr/local' '--with-jpeg-dir=/usr/local'
'--with-png-dir=/u1/source/libpng-1.0.12'
'--with-freetype-dir=/usr/local/include/freetype2'
'--with-tiff-dir=/u1/source/tiff-v3.5.6-beta' '--with-gd=/u1/source/gd-2.0.1'
'--with-mysql=/usr/local/bin/mysql-3.23.41' '--with-pdflib'
'--enable-static-pdflib' '--enable-ftp' '--enable-gd-native-tt'
'--enable-gd-imgstrttf' '--enable-trans-sid'