Sorry B.A.T,

Alain's quote is taken directly from http://www.php.net/manual/en/function.fopen.php

Using/not "b" does make a difference under Windows - haven't tested it under *nix!

The 'end' of a Windows file can be defined in two ways: an ASCII file ends with 
CTRL+Z, a 'binary' file ends
where the header/catalog entry says so (not sure if that terminology has 'traveled' 
properly). Somewhat
obviously, the reason for the latter is that the ASCII code for CTRL+Z may 
coincidentally appear within the
middle of some binary digit (where it doesn't mean either CTRL-Z or eof). Does *nix 
take filesizes from the
catalog/file header information? and only there?

Regards,
=dn


> >From the manual - Last thing to read ;)
> >"Note: The mode may contain the letter 'b'. This is useful only on systems
> >which differentiate between binary and text files (i.e. Windows. It's
> >useless on Unix). If not needed, this will be ignored. "
>
> If UNIX system doesn't difference between binary and text files, how are for
> ex
>
> 'char *fgets()' respectively 'char *gets()'
>
> supposed to be working then?
>
> When opening a file in binary mode (b) Unix and MS Windows behaves more or
> less the same, on the other hand when opening a file in text write mode (w
> or a) then UNIX might differ from MS Windows. I've noticed that MS VC++
> appends an ctrl-Z on the end of text files while writing to them. If Borland
> C++ does the same, I don't know. But as far as my limited knowledge extends,
> neither CC, cc, gcc or g++ does in this behavior.
>
> Conclusion:
>
> Opening a file in binary mode works more or less the same on UNIX and
> Windows, but text mode works different on the both systems.

=dn


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to