Computer/초보자를 위한 C 언어 300제
069. 문자열을 구분자로 분리하기 2(strpbrk)
Theo Kim
2011. 2. 9. 03:44
#include <stdio.h>
#include <string.h>
#define TOKEN " "
void main( void )
{
char string[100];
char *pos;
puts( "문자열을 입력한 후 Enter 키를 치세요!" );
gets( string );
pos = strpbrk( string, TOKEN );
while( pos != NULL )
{
puts( pos++ );
pos = strpbrk( pos, TOKEN );
}
}