Re: fopen on windows

From: Date: Fri, 11 Nov 2005 21:18:14 +0000
Subject: Re: fopen on windows
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-225649@lists.php.net to get a copy of this message
Jay Blanchard wrote:
[snip] Well, it's a pretty model example of a line-by-line file read. I can't see anything wrong with it, so perhaps the problem lies elsewhere. There's no other files with the same name in your include_path? Maybe something to do with auto_detect_line_endings or whatever it's called, in php.ini? (I know, probably a long shot.) [/snip] The output now looks like.... [snip] based on the following code; $theFile = fopen("docs/InstallationInstructionMaster.txt", "rb") || die; while(!feof($theFile)){ $theLine = fgets($theFile); $lineArray = explode("\t", $theLine); print_r($lineArray); } fclose($theFile); It appears that something is getting read, but what?
Blank lines. Just to see if the problem is fgets(), try this: // Left off the "b" because it ain't binary :) $theFile = file_get_contents( "docs/InstallationInstructionMaster.txt", "r" ) or die; $lines = explode( "\n", $theFile ); foreach( $lines as $line ) { $line = explode( "\t", $line ); print_r( $line ); }

« previous php.general (#225649) next »