S
sravanreddy001
Hi,
Can anyone give the best way (faster) to write the vector contents to a file?
Is there a better way to do it than below method?
for(unsigned i=0;i<terms.size();i++){
sprintf(temp,"%d %s\n",i,terms.c_str());
ids_n_terms = ids_n_terms + temp;
}
Is the string addition a very expensive operation? (will a new memory allocation takes place)
there are around 5,00,000 (strings) in the vector, and these have to stored in
<id term> format.
Thanks,
Sravan.
Can anyone give the best way (faster) to write the vector contents to a file?
Is there a better way to do it than below method?
for(unsigned i=0;i<terms.size();i++){
sprintf(temp,"%d %s\n",i,terms.c_str());
ids_n_terms = ids_n_terms + temp;
}
Is the string addition a very expensive operation? (will a new memory allocation takes place)
there are around 5,00,000 (strings) in the vector, and these have to stored in
<id term> format.
Thanks,
Sravan.