problems with strtok()

M

Michael

Hi All,

I'm trying to tokenise a string using strtok(), but I cat get it to give me
the second token.
What have I done wrong here?

void function(int *Result, char *Input){

....variables declared...

do{
temp = getNumerator(str);
i++;
temp = getDenominator(str);
i++;
str = strtok(combInputFrac,":");
}while(str);
}

Thanks for your help.....
 
M

Michael Mair

Michael said:
Hi All,

I'm trying to tokenise a string using strtok(), but I cat get it to give me
the second token.
What have I done wrong here?

void function(int *Result, char *Input){

...variables declared...

do{
temp = getNumerator(str);
i++;
temp = getDenominator(str);
i++;
str = strtok(combInputFrac,":");
}while(str);
}


Have a look at
http://c-faq.com/lib/strtok.html
Ideally, have a look at the whole FAQ...

Cheers
Michael
 
M

Michael

Michael Mair said:
Michael said:
Hi All,

I'm trying to tokenise a string using strtok(), but I cat get it to give
me the second token.
What have I done wrong here?

void function(int *Result, char *Input){

...variables declared...

do{
temp = getNumerator(str);
i++;
temp = getDenominator(str);
i++;
str = strtok(combInputFrac,":");
}while(str);
}


Have a look at
http://c-faq.com/lib/strtok.html
Ideally, have a look at the whole FAQ...

Cheers
Michael


Thanks Michael :)
got it fixed....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top