#include #include struct date {int h; int m; int s;}; int main(void) { char s[] = "$GPGGA,191410,"\ "4735.5634,N,00739.3538,E,"\ "1,04,4.4,351.5,M,48.0,M,,*45"; char *wort; char buffer[10]; struct date test; wort = strtok(s, ","); printf("\t%s\r\n", wort); wort = strtok(NULL, ","); printf("\t%s\r\n", wort); strncpy(buffer, wort, 7); test.h = (buffer[0] - '0') *10; test.h += (buffer[1] - '0'); test.m = (buffer[2] - '0') *10; test.m += (buffer[3] - '0'); test.s = (buffer[4] - '0') *10; test.s += (buffer[5] - '0'); printf ("_ %2d:%2d:%2d\r\n", test.h, test.m, test.s); return 0; }