You are here: RE: [PHP] String to Stream « PHP « IT news, forums, messages
RE: [PHP] String to Stream

Posted by "Michael Sims" on 08/05/05 22:19

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация