String output without linebreak

Hi there,

I want to process data (using fstream) and print out the progress. This doesn't work with cout <<, only with puts, but this causes a line-break but I want a progress bar like this : [=====================].

I've already searched for an hour in the reference and with google and I dont manage to put a string without a linebreak:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23


     while (ein.good())       // loop while extraction from file is possible
  {
         
         
    c = ein.get();       // get character from file
    if (ein.good()){
      
      aus.put(encc(c));
      
      if (zaehler%p==0){ // p is 5 percent of the progress
      
          puts("=");  // print one = for every 5% processed
          
      }
      
    
    }
    
  }



Please tell me how to do it without the linebreaks...

Many thanks in advance,

Lukas
Flush cout to make sure everything that you have printed so far becomes visible.
std::cout << '=' << std::flush;

http://en.cppreference.com/w/cpp/io/manip/flush
Last edited on
great! Works as it shall. Thank you very much !

Lukas
Topic archived. No new replies allowed.