Alex, >> Is there any way I can write out to a file as I go - rather than >> storing it all in an in-memory string stream?
> Ah, I figured out a way to do this.. I write to the string stream as I go, and every N times through the loop I append it to a file and flush the string stream. The string stream becomes flush itself on disk when it exceed 10 or 50 megabytes. So the first version may write everything into single stream and survive. But you're right, you may append small sections using appropriate third argument of string_to_file(), then set stream variable to the result of next string_output_string() call. Best Regards, IvAn Mikhailov.