C - Is this the right way to use strtok in the following situation -


if have string contains 10x15. , want separate 10 , 15. following code correct. concerned second part of code, putting "null" there right thing do.

char * stringsixrows = strtok(stringsix[0], "x"); char * stringsixcollumns = strtok(null, "null");  

//i put second null there cause end of string, im not sure if right though.

i'd "canonical" way obtain "pointer remaining string" is:

strtok(null, "") 

strtok searches any of delimiters in provided string, if don't provide delimiters, cannot find , stops @ end of input string.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -