RE: String to Stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Eric Gorr wrote:
> Again, I would like to treat the string as a stream.
>
> One possible way to accomplish this would be to simply write the
> string to a temporary file, open the file with fopen and then use
> fscanf, fseek, etc. to process the text.
>
> However, I am assuming there is an easier way (i.e. a method without
> the file io overhead) to be able to treat the string as a stream.

If you're willing to go the lengths of writing out a temporary file and the overhead
is the only thing that is stopping you, AND you are running on Linux, consider using
a tmpfs volume (RAM-based) and write your temp files there.  That should almost
eliminate any overhead of writing the file out.  tmpfs is flexible, as it grows (up
to a maximum you can set) and shrinks as necessary, and can even have its contents
paged out to the swap file if they haven't been accessed in a while.  Assuming
you've got the RAM to spare, setting one up is as simple as creating a directory and
adding an entry to /etc/fstab.  I've used tmpfs volumes for similar things in the
past with great success.  FWIW...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux