fork(1) download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6. char c[] = "AG23,VU,Blablu blablu,8";
  7. char sem[5];
  8. char type[5];
  9. char title[80];
  10. int value;
  11.  
  12. if (4 == sscanf(c, "%4[^,],%4[^,],%79[^,],%d", sem, type, title, &value))
  13. {
  14. printf("sem=[%s]\n", sem);
  15. printf("type=[%s]\n", type);
  16. printf("title=[%s]\n", title);
  17. printf("value=[%d]\n", value);
  18. }
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 1832KB
stdin
Standard input is empty
stdout
sem=[AG23]
type=[VU]
title=[Blablu blablu]
value=[8]