title: using sscanf to read string with spaces from char[]
body: <p>I have a string and i want to split it in to variables for example:</p>
  
  <pre><code>char[]="i 176064 Patterson";
  </code></pre>
  
  <p>i want by using sscanf to have:</p>
  
  <pre><code>firstword = "i"
  secondword = 176064
  thirdword = "Patterson"
  </code></pre>
  
  <p>but secondword must be a int.</p>
  
  <p>how is that possible?</p>
  
  <p>EDIT:</p>
  
  <p>i have write this code:</p>
  
  <pre><code>int main()
  {   char cstr[] = "i 176064 Patterson Denise 8.58 11 DEN 15788 ";
      string option,name,sername,dep;
      int studID,numofc,post;
      float gpa;
      sscanf(cstr, "%s %d %s %s %2.2f %d %s %d",option,&amp;studID,name,sername,&amp;gpa,&amp;numofc,dep,&amp;post);
  
  }
  </code></pre>
  
  <p>but i get a compiler error </p>
  
  <blockquote>
    <p>error: cannot pass objects of non-trivially-copyable type ‘std::string {aka class std::basic_string}’ through ‘...’|</p>
  </blockquote>
  
  <p>any ideas?</p>