[snip]
On Fri, November 11, 2005 2:51 pm, Jay Blanchard wrote:
> $theFile = fopen("docs/InstallationInstructionMaster.txt", "r") ||
> die;
Don't use || when you mean 'or' :-)
Nor sure it really matters here, but better to follow the crowd and
use 'or' here.
[/snip]
Okie dokie. Found there to be
On Fri, November 11, 2005 3:23 pm, Jay Blanchard wrote:
> // Left off the "b" because it ain't binary :)
I think you will find this is the crucial difference if you go back to
your original and take it out.
Your file is text.
It's not binary.
On Windowz, that matters, for some odd reason.
--
On Fri, November 11, 2005 2:51 pm, Jay Blanchard wrote:
> $theFile = fopen("docs/InstallationInstructionMaster.txt", "r") ||
> die;
Don't use || when you mean 'or' :-)
Nor sure it really matters here, but better to follow the crowd and
use 'or' here.
> while(!feof($theFile)){
> $theLine =
[snip]
You need "or" not || here. The operator priorities are such that the above
means
...
which assigns the result of fopen() to $theFile, and then executes die if
it's false -- which is much more satisfactory. ;)
[/snip]
Originally I did not have any '||' or 'or' in the conditional check, with
On 11 November 2005 21:21, Nathan Tobik wrote:
> I've always used:
>
> fopen("C:\\dir\\dir\\file.txt");
>
> on windows, I'm not sure how PHP interprets the slashes internally
> though...
On Windows, "/" in filenames is internally translated by PHP to "\" -- which
means you can write code that
On 11 November 2005 20:52, Jay Blanchard wrote:
> $theFile = fopen("docs/InstallationInstructionMaster.txt", "r") ||
> die;
You need "or" not || here. The operator priorities are such that the above
means
$theFile = (fopen("docs/InstallationInstructionMaster.txt", "r") || die);
which assign
[snip]
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"
I've always used:
fopen("C:\\dir\\dir\\file.txt");
on windows, I'm not sure how PHP interprets the slashes internally
though...
Nate Tobik
(412)661-5700 x206
VigilantMinds
> $theFile = fopen("docs/InstallationInstructionMaster.txt", "rb") ||
die;
--
PHP General Mailing List (http://www.php.n
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
[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.in
Jay Blanchard wrote:
$theFile = fopen("docs/InstallationInstructionMaster.txt", "r") || die;
I'm not sure if it would make any difference, but I usually use "or" in
this case rather than "||", and I know they have different operator
precedence.
while(!feof($theFile)){
$theLine = fg
$theFile = fopen("docs/InstallationInstructionMaster.txt", "r") || die;
while(!feof($theFile)){
$theLine = fgets($theFile, 4096);
echo $theLine . "\n";
}
fclose($theFile);
The above code appears to work, but all that is output is lines of line
breaksno data. The file is a tab
12 matches
Mail list logo