PHP + binary files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • E.T. Grey

    #1

    PHP + binary files

    I am persisting nested (tree) structures in C to binary file. I want to
    be able to read/write this data using PHP - is this possible?. That is
    to say, can PHP read/write C structures to file so that the contents may
    be transferred to a C client app?

    The idea is that I store the binary files at the server end and clients
    can request for the file(s). Is this possible ?

    PS- the client is (of course) a C++ client, capable of understanding the
    returned structure. Another point worth mentioning is that the server
    will be on Unix and the client on Windows. Can I force PHP to write the
    binary file using Network byte order so that endianess is not an issue?

  • Sjoerd

    #2
    Re: PHP + binary files

    Take a look at pack and unpack.

    Comment

    • Andy Hassall

      #3
      Re: PHP + binary files

      On Wed, 1 Feb 2006 05:06:48 +0000 (UTC), "E.T. Grey"
      <nebula@alpha-centauri.com> wrote:
      [color=blue]
      >I am persisting nested (tree) structures in C to binary file. I want to
      >be able to read/write this data using PHP - is this possible?. That is
      >to say, can PHP read/write C structures to file so that the contents may
      >be transferred to a C client app?
      >
      >The idea is that I store the binary files at the server end and clients
      >can request for the file(s). Is this possible ?
      >
      >PS- the client is (of course) a C++ client, capable of understanding the
      >returned structure. Another point worth mentioning is that the server
      >will be on Unix and the client on Windows. Can I force PHP to write the
      >binary file using Network byte order so that endianess is not an issue?[/color]

      You probably want: http://uk.php.net/pack

      --
      Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
      http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

      Comment

      Working...