Hi, You should use a while(!feof) syntax so that can verify that the file is not empty. You should also use $text = implode("",@file($filename)); Thats the easiest way to read a file. It will put each lines into an array and you will just implode it into a variable
-- Merci de nous avoir choisi. - Thanks you for your choice. Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] [EMAIL PROTECTED] www.GroupAKT.com - Hébergement Group. www.WorldAKT.com - Hébergement de sites Internet "David McInnis" <[EMAIL PROTECTED]> a écrit dans le message de news: 021001c25210$21c38010$[EMAIL PROTECTED] > I use fopen() in a template system that I have developed. I noticed > that occasionally I get blank pages served up. Here is one of my > snippets. > > $filename = "$ROOTDIR/content/myfile.txt"; > $fd = fopen ($filename, "r"); > $PAGE_CONTENT = fread ($fd, filesize ($filename)); > fclose ($fd); > > Doing this I get the contents of the file read into the $PAGE_CONTENT > variable. > > I never use fopen() to write to files. Only read with the "r" > directive. So what could be causing my conflicts? Do I need to flock > the file to shared? > > I am running Linux PHP, Apache and Linux. > > David McInnis > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php