"C언어 strtok()"의 두 판 사이의 차이

40번째 줄: 40번째 줄:
==참고==
==참고==
* https://www.ibm.com/support/knowledgecenter/ko/ssw_ibm_i_73/rtref/strtok.htm
* https://www.ibm.com/support/knowledgecenter/ko/ssw_ibm_i_73/rtref/strtok.htm
* https://www.tutorialspoint.com/c_standard_library/c_function_strtok.htm


[[분류: C]]
[[분류: C]]
[[분류: 문자열]]
[[분류: 문자열]]
[[분류: string.h]]
[[분류: string.h]]

2017년 11월 24일 (금) 00:45 판

1 개요

C언어 strtok()
  • 문자열 토큰화 함수
#include <string.h>
char *strtok(char *string1, const char *string2);

2 예시

#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]

3 같이 보기

4 참고

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