sscanf

/* sscanf example */
#include <stdio.h>

int main ()
{
  char sentence []="Rudolph is 12 years old";
  char str [20];
  int i;

  sscanf (sentence,"%s %*s %d",str,&i);
  printf ("%s -> %d\n",str,i);
  
  return 0;
}

Output:

Rudolph -> 12
posted @ 2012-03-04 22:01  zxfx100  阅读(202)  评论(0编辑  收藏  举报