> struct BACACHE
>
> char author[300][100];
> int top;
> time_t uptime;
> time_t touchtime;
> int busystate;
> };
>
> is there any way to get these data into PHP with certain variable type ?
>
> I've tried to use " unpack() " function, but I found that unpack() can't
> unpack a char array ( I mean string) , it breaks string into
characters....
> please help me...
Almost for sure you're going to have to read it byte-by-byte and parse it...
Here's a start:
<?php
$path = '/path/to/bacache.xxx';
# 'b' is only needed on Windoze, but shouldn't hurt Un*x
$file = fopen($path, 'rb') or die("Could not open $path");
while (!feof($path)){
$author = fread($file, 300*100);
# You may or may not need to convert each byte somehow...
# Is a C int 2 or 4 bytes this week? Sigh.
$top = fread($file, 4);
# Now, *THAT* almost for sure needs converting...
# Maybe you'll be lucky and hexdec will do it...
$uptime = fread($file, 4);
$touchtime = fread($file, 4);
$busystate = fread($file, 4);
}
?>
You'd probably want all sorts of error-checking in there...
--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]