Reputation: 15913
I've worked with reading and writing text files with PHP. Now, I'd like to read and write binary files. I've not found any useful resources/tutorials for doing this with PHP5. Is it possible? How?
Specifically, I'll be searching for specific 2-byte patterns.
If it matters, I'm on a Mac (OS X 10.4 Tiger).
Upvotes: 2
Views: 2518
Reputation: 1238
You can fopen() your binary with 'b' (for binary) attached to the mode parameter. Reading from the stream is done by fread(). PHP offers the common binary operators for manipulating your data.
Upvotes: 4