Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help read from stdin

Status
Not open for further replies.

chourico

Programmer
Dec 4, 2005
2
PT
Hi i want to read multiple data from stdin like this:

Comand name:number name:number ...

Code:
void app() {
   char line[INBUFF];

   if (fgets(line, sizeof(line), stdin) != NULL) {
      sscanf(line, "%s", comand);
      verify(comand);
           
      ... 

      
     
   }

I want to do something like this, but the problem is how can i get the name and the number separately and them verify it to.
 
Parse the string.
You can use strtok(), strstr(), or just walk through the string character by character and find the sub-strings you want by yourself...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top