Blade,
That's tricky. I'm going to assume that you *have* to do this 1-second
refresh. If you are taking in enough data to need that fast refresh
rate, and you're accumulating this data and rewriting the KML just as
fast, keep in mind that your PC will have to work harder (longer) each
iteration.
Here's what I'd do:
1. Make sure you are open()ing the output KML file at the (reasonable)
last minute (that is, don't hold the file open for the entire
duration, open it once you're ready to write, then close it.
(Basically, try to avoid a situation where you're looping through the
data and appending kml to the file)
2. Use libkml (
http://code.google.com/p/libkml/) to create your KML in
a data structure within your program, so the entire file-writing code
looks something like
std::ofstream file;
file.open("output.kml");
file << kml_data_structure;
file.close();
That'd be my recommendation.
-ns