How can I put back a character that I've read when I detect it's the start of a new row?

Posted by gcc on Stack Overflow See other posts from Stack Overflow or by gcc
Published on 2010-06-05T14:56:52Z Indexed on 2010/06/05 15:02 UTC
Read the original article Hit count: 127

Filed under:
 char nm;   int i=0;
    double thelow, theupp; double numbers[200];



 for(i=0;i<4;++i)
  {   {  char nm;  double thelow,theupp; /*after erased ,created again*/ 
         scanf("%c %lf %lf", &nm, &thelow, &theupp);
            for (k = 0; ; ++k) ;
               { scanf("%lf",numbers[k]);
                      if(numbers[k]=='\n')  break;
               }
         /*calling function and sending data(nm,..) to it*/ 
   } /*after } is seen (nm ..) is erased*/
          ;
  }

I want say compiler : hey my dear code read only i-th row,dont touch characters at placed in next line. because characters at placed in next line is token after i increased by 1 and nm ,thelow,theupp is being zero or erased after then again created.

how can I do ?

input;

D -1.5 0.5 .012 .025 .05 .1 .1 .1 .025 .012 0 0 0 .012 .025 .1 .2 .1 .05 .039 .025 .025
B 1 3 .117 .058 .029 .015 .007 .007 .007 .015 .022 .029 .036 .044 .051 .058 .066 .073 .080 .088 .095 .103

© Stack Overflow or respective owner

Related posts about c