[출처 : http://www.joinc.co.kr/modules/moniwiki/wiki.php/Code/C/token]
사용방법
char *token(char *str, char *src, const char* sep);
- str : 토큰 분리를 위한 원본 문자열
- src : 토큰 분리후 다음 문자열을 가르키는 포인터
- sep : 토큰
- return : 더이상 토큰이 없거나 '\0'을 만나면
#include "token.h" int main() { char src[20]; char str[20]; char* next = &src[0]; strcpy(src, "ab1de12eoqd12dq"); while(next = token(str, next, "12")) { printf("%s\n", str); } return(0); }