[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] strtok_r
From: |
Dave Hylands |
Subject: |
Re: [avr-gcc-list] strtok_r |
Date: |
Sun, 29 Jun 2008 20:02:37 -0700 |
Hi Gerard,
> On Sun, Jun 29, 2008 at 10:48 AM, Gerard Marull Paretas
> <address@hidden> wrote:
>> I'm just looking for the hex value after '*' character, so strtok should
>> return a pointer to the first number, right?
>
> The first time you call strtok_r it will return a pointer to the
> beginning of the buffer. You should then call strtok_r again with a
> NULL to retrieve the second token, which will be the characters after
> the '*'.
A simpler approach might be to do something like:
if (( token = strchr( buffer, '*' )) != NULL )
{
token++;
// token now points to the character after the '*'
}
--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/