C언어 strtok()

Jmnote (토론 | 기여)님의 2017년 11월 24일 (금) 00:38 판 (새 문서: ==개요== ;C언어 strtok() <source lang='console'> #include <stdio.h> #include <string.h> int main() { char string[] = "a string, of, ,tokens\0,after null terminator"; ch...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요

C언어 strtok()
#include <stdio.h>
#include <string.h>
 
int main() {
    char string[] = "a string, of, ,tokens\0,after null terminator";
    char *token;
    token = strtok(string, ",");
    do {
        printf("token: [%s]\n", token);
    }
    while( token = strtok(NULL, ",") );
}
// token: [a string]
// token: [ of]
// token: [ ]
// token: [tokens]

2 같이 보기

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}