title: C++ string formatting - fixed width floating point, and string with spaces at offset
body: <p>I'm playing around with stringstreams, and I've got a line like:</p>
  
  <pre><code>10 651.23 Some longer name
  </code></pre>
  
  <p>I'd like to fetch it into uint, double and string like 10, 651.23, "Some longer name"</p>
  
  <p>So I've tried </p>
  
  <pre><code>    iss &gt;&gt; quantity &gt;&gt; price &gt;&gt; std::noskipws &gt;&gt; name;
  </code></pre>
  
  <p>But it seems it isn't so easy as it looks. How can I get rest of the string including whitespaces?</p>
  
  <p>Later I want to show the float with leading character and fixed precision:</p>
  
  <pre><code>    std::cout &lt;&lt; std::setprecision(2) &lt;&lt; std::fixed &lt;&lt; std::setw(7) &lt;&lt; std::setfill('.') &lt;&lt; price;
  </code></pre>
  
  <p>However when I use std::fixed, my fill and width get rejected. How to fix that?</p>
  
  <p>Thanks</p>
  
  <p>Current code:</p>
  
  <pre><code>std::string filename;
  
  std::ifstream is;
  do {
  
      std::cout &lt;&lt; "Podaj nazwę pliku do wczytania: " &lt;&lt; std::endl;
      std::cin &gt;&gt; filename;
      is.open(filename.c_str());
  
      if(is.good()) break;
  } while(true);
  
  std::string name;
  std::string wtf;
  unsigned int quantity = 0;
  double price = 0;
  unsigned int i = 1;
  
  while(is &gt;&gt; quantity &gt;&gt; price &gt;&gt; std::ws &amp;&amp; std::getline(is, name)) {
      std::cout &lt;&lt; "| ";
      std::cout &lt;&lt; std::setw(2) &lt;&lt; i++ &lt;&lt; " | ";
      std::cout &lt;&lt; std::setw(30) &lt;&lt; std::setfill('.') &lt;&lt; name &lt;&lt; " | ";
      std::cout &lt;&lt; std::setw(3) &lt;&lt; std::setfill(' ') &lt;&lt; quantity &lt;&lt; " x ";
      std::cout &lt;&lt; std::setprecision(2) &lt;&lt; std::setw(10) &lt;&lt; std::setfill(' ') &lt;&lt; std::fixed &lt;&lt; price &lt;&lt; " zl | ";
      std::cout &lt;&lt; std::setw(11) &lt;&lt; std::setfill(' ') &lt;&lt; quantity * price &lt;&lt; " zl |";
      std::cout &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>The file looks like:</p>
  
  <pre><code>10 12999 TV55AA8000 smarttv ultra HD
  5 12990 TV55AB600 smarttv ultraHD
  20 9999 TV55GD2340s smarttv
  10 7999 TV463400 funkcja 3D
  20 1699.5 telewizor super!
  30 1400 telewizor 3d 1000Hz
  20 12999 telewizor nr 1
  30 12000 EE55650 smarttv
  10 1000 ED325400s
  10 14350.00 EE80234
  5 5600.00 TV60ED23231 smart tv plazma
  10 2000.00 TV320323
  1 12999.00 TV66EE231231 smarttv
  12 3400.00 TV4243dss 3D
  </code></pre>