[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] strtok_r

From: Gerard Marull Paretas
Subject: [avr-gcc-list] strtok_r
Date: Sun, 29 Jun 2008 09:09:19 +0200


I'm trying to parse a string using strtok_r, but I have no success.

The string is "$GPGGA,070250.00,4159.08406,N,00301.18212,E,1,08,1.34,00048,M,050,M,,*62"
(pointed by char *buffer)

and the code...

char *token;
char *save_ptr;
token = strtok_r(buffer,"*", &save_ptr);
if(token == NULL) return S_ERR;

//The following lines send the content using usart, so I can see the values

The values sent trough usart, are "$G". If I use save_ptr instead of token in the usart_send calls, the result is "62" (as it should be using token...). The * character is always replaced by 0, so it seems to work.

Maybe I'm missing something?

Thanks, Gerard

reply via email to

[Prev in Thread] Current Thread [Next in Thread]