fork(25) download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void) {
  5. char row[] = "11/12/1999 foo:54654 some data..... ms:12123343 hot:32";
  6. char *ms;
  7. int i;
  8.  
  9. ms = strstr(row, "ms:");
  10. if (ms == NULL) /* error: no "ms:" in row */;
  11. if (sscanf(ms + 3, "%d", &i) != 1) /* error: invalid data */;
  12. printf("ms value is %d.\n", i);
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0.01s 1676KB
stdin
Standard input is empty
stdout
ms value is 12123343.