strtok小記

strtok, extract tokens from strings,從字符串中截取子串 上圖中,第一次調用返回的token爲HELLO; 第二次返回的是WORLD; 第三次返回的是NULL,表示處理完畢了。 關於strtok的幾點說明: strtok會修改字符串str中的字符爲’\0’,所以str一定不能是字符常量; strtok內部維護一個靜態變量saveptr,用於索引剩下的字符串; 由於
相關文章
相關標籤/搜索