Use PHP for reading binary files created by C software
| From: | Tim Molendijk | Date: | Sun, 24 Nov 2002 22:23:47 +0000 |
| Subject: | Use PHP for reading binary files created by C software | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-125899@lists.php.net to get a copy of this message | ||
Hi all,
I would like to use PHP to read a binary file which contains a structure in
C, such as:
struct simple {
int a;
float b;
};
with f.e. a = 2 and b = 1.5.
Please notice that this is stored as *binary* data and not as text.
I know it is possible to read binary files using fgets() in PHP 4.3.0 or
higher but then I still don't have a clue how to actually *do* it...
Is it even possible to read binary files created by C software and if so,
how to do this in practice - examples would be very welcome.
Thanks in advance,
Tim