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