I have a these kind of code in my program:
std :: cout << process_prompt << std :: left << std :: setw( 40 ) << "Looping on tree: clust_tree.";
some_function();
std :: cout << std :: string( 52, '\b' );
The some_function() has a loop:
for( Int_t i = 0; i < n_entries; ++i )
{
(some stuff...)
if( i % 100000 == 0 )
{
percent_done = static_cast<float>(i) / n_entries;
std :: cout << std :: setw( 4 ) << static_cast<int>(percent_done * 100) << "p" << std :: flush;
std :: cout << std :: string( 5, '\b' ) << std :: flush;
}
}
The process_prompt is just a fancy way I use to write a colored message saying "Process: ".
What I expect to happen is (each row is an update of the previous):
Process: Looping on tree: clust_tree. 0 p
Process: Looping on tree: clust_tree. 10 p
...
What actually happens:
Process: Looping on tree: clust_tree. 0 p
12 pss: Looping on tree: clust_tree. 0 p
54 pss: Looping on tree: clust_tree. 0 p
Somehow my cursor is always moved to the beginnig of the line. Can someone tell me what I am doing wrong? Thank you for the reponses!
Aucun commentaire:
Enregistrer un commentaire