title: How to exactly use (negated) character classes or scansets while using sscanf on a string?
body: <p>I have multiple rows of strings and I want to store it in the form:</p>
  
  <pre><code>string1   string2   float1   float2   float3   float4   float5   float6
  </code></pre>
  
  <p>as in the conversion specifiers mentioned below.  For example:</p>
  
  <pre><code>Kevlar ABS 43.42 13.94 1.35 0.35 0.112 2.74
  </code></pre>
  
  <p>Two strings are Kevlar and ABS, the remaining 6 are numbers. There are white space characters between all 8 of them.</p>
  
  <p>I am wondering how I can use scansets or (negated) character classes only to store the required information in all the 8 conversion specifiers.</p>
  
  <p>The struct is declared as follows:</p>
  
  <pre><code> struct lamina
   {
      char lamina_fiber[30];
      char lamina_matrix[30];
      float E1,E2,p,v12,v21,G12;
      struct lamina *nextnode;
   };
  
  
   head=(struct lamina *)calloc(1,sizeof(struct lamina));
   current=head;
  
   for(int i=1;i&lt;=index_elements;i++)
   {
       sscanf(rows[i],"%s %s %f %f %f %f %f %f", 
              current-&gt;lamina_fiber,current-&gt;lamina_matrix,&amp;current-&gt;E1, 
              &amp;current-&gt;E2,&amp;current-&gt;p,&amp;current-&gt;v12,&amp;current-&gt;v21, 
              &amp;current-&gt;G12);
       current-&gt;nextnode=(struct lamina *)calloc(1,sizeof(struct lamina));
       current=current-&gt;nextnode;
   }
  
   current=head;
  
   for(int i=1;i&lt;=index_elements;i++)
   {
         printf("%s %s %f %f %f %f %f %f", current-&gt;lamina_fiber, current-&gt;lamina_matrix,
                current-&gt;E1, current-&gt;E2,current-&gt;p, current-&gt;v12,  
                current-&gt;v21, current-&gt;G12);
         current=current-&gt;nextnode;
   }
  </code></pre>
  
  <hr>
  
  <p>NB: Version 1 of the code in the question contained:</p>
  
  <pre><code>if(n=(sscanf(rows[i],"%s %s %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f", 
  current-&gt;lamina_fiber,current-&gt;lamina_matrix,&amp;current-&gt;E1, 
  &amp;current-&gt;E2,&amp;current-&gt;p,&amp;current-&gt;v12,&amp;current-&gt;v21,&amp;current-&gt;G12))!=8);
  </code></pre>
  
  <p>This explains the reference to <code>if</code> and a trailing semicolon in the answer.</p>