タグ付けされた質問 「strtok」

15
strtok()はどのように文字列をCのトークンに分割しますか?
strtok()機能の働きを説明してください。マニュアルには、文字列をトークンに分解すると書かれています。マニュアルでは実際に何が行われているのか理解できません。 私は上の時計を追加strし、*pch最初のwhileループが発生したとき、内容はその作業をチェックするstrだけで「これ」でした。以下に示す出力はどのように画面に印刷されましたか? /* strtok example */ #include <stdio.h> #include <string.h> int main () { char str[] ="- This, a sample string."; char * pch; printf ("Splitting string \"%s\" into tokens:\n",str); pch = strtok (str," ,.-"); while (pch != NULL) { printf ("%s\n",pch); pch = strtok (NULL, " ,.-"); } return …
114 c  string  split  token  strtok 
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.