Jump to content

Why is binary mode missing from fopen() modes?


johnmerlino1

Recommended Posts

Same for the 't' mode.  I think it is because there are so many caveats mentioned in the comments that one needs to be "more" aware of how and why to use both 'b' and 't' mode.

 

But if I want to open a file for reading, can I just use r or do I need to attach b as well?

 

$fp = fopen(“$DOCUMENT_ROOT/../orders/orders.txt”, ‘rb’);

 

Not sure what you mean by it being missing. The binary flag is mentioned. They just don't list r and rb as different modes because it's unnecessary.

Windows offers a text-mode translation flag ('t') which will transparently translate \n to \r\n when working with the file. In contrast, you can also use 'b' to force binary mode, which will not translate your data. To use these flags, specify either 'b' or 't' as the last character of the mode parameter.

It's been explained twice to you.  If your entire question is simply curiosity about the option, then you won't get anymore here.  And if your concern is about the accuracy of the manual, well then, you are going to have a field day with other functions.

 

Signing off - too boring.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.