
Efficient string handling
We need to build up an output file of multi-lined messages. Only at the end
do we know if an individual message it is valid or not. Then it should
either go on the end of a valid output file or then end of a valid error
file.
My problem is that we have noticed that building up a string with embedded
CrLfs is a couple of hundred times slower than writing a file line by line.
I assume this is because the string is constantly being moved around memory
as it expands. Is there anyway to make string concatenation more efficient
?. It suits our application to have the full message available - as we also
want to send it out to message queueing systems as a unit.
At the moment, I am just using the & operator to build up the string.
Any help???
TvG