Hi Yasuo,

thanks for the hint ... I'll give WDDX a try after some thought
(and because I am using XML anyway).

Regards, Arne


> -----Original Message-----
> From: Yasuo Ohgaki [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, May 05, 2001 2:11 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] something like a C "struct" or "union" in PHP?
>
>
> PHP does not have struct. You can do similar things with class or
> array. You
> probably interested in wddx serialize or serialize function to
> make it work your
> snippet.
>
> Regards,
> --
> Yasuo Ohgaki
>
>
> ""Arne Borkowski (borko.net)"" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi Folks,
> >
> > I want to do the following:
> >
> >
> > $f = fopen($filename", "r");
> >
> > while( !feof($f) ) {
> > $len=1;
> > $RECSIZE=128
> >
> > while($n=1;$n<=$len;$n++)
> >   $data = fread($f, $RECSIZE);
> >
> > $rectype = $data[4];
> >
> > switch($rectype) {
> >
> > case "A": $numARec++;
> >     $len=1;
> >
> > // do something with the
> > // contents of $data
> >
> >     break;
> >
> > case "C": $numCRec++;
> >     $len=2; // at least!
> >
> > // do something with the
> > // contents of $data
> >
> >     break;
> >
> > case "E": $numERec++;
> >     $len=1;
> >
> > // do something with the
> > // contents of $data
> >
> >     break;
> > } /* switch */
> >
> > fclose($f);
> >
> > } /* while */
> >
> > This snippet reads a data file in 128 bytes truncs
> > and needs to analyse the contents. As each 128 bytes
> > trunc has a certain structure (say: fields to access)
> > I would appreciate a thing like a C "struct" or so.
> >
> > In C I could eaysly read the RECSIZE bytes into a
> > struct and access certain bytes via a "named" part
> > of it. Is there anything similar to this in PHP? I
> > couldn't find a "struct" or so in the manual. The
> > site's search engine said 41 hits for "struct" in
> > the Web Site content, but didn't show the matching
> > docs?! I need help on "struct" from you guys!
> >
> > TIA
> >
> > -Arne
> >
> >
> >
> > --
> > 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]
> >
>
>
> --
> 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]
>


-- 
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]

Reply via email to