home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_10_10 / 1010025a < prev    next >
Text File  |  1992-08-10  |  337b  |  19 lines

  1. #include <stdio.h>
  2.  
  3. main()
  4. {
  5.     char *s = "hello there 12345.67089";
  6.     char s1[6], s2[6], s3[6];
  7.     int n1, n2, nargs;
  8.     float f;
  9.     
  10.     nargs = sscanf(s,"%20s%3s%s%3d%5f%d",
  11.       s1,s2,s3,&n1,&f,&n2);
  12.     printf("%d: %s,%s,%s,%d,%f,%d\n",
  13.       nargs,s1,s2,s3,n1,f,n2);
  14.     return 0;
  15. }
  16.  
  17. Output
  18. 6: hello,the,re,123,45.669998,89
  19.