//////////////////////////////////////
Written by SeungHwan 2008.08.20
File of GetToken()
기능 : 문자열로 입력된 수식을 구분
//////////////////////////////////////
#include<stdio.h>
int GetToken(char* temp , char* buffer)
{
static int i_T_Count=0;
static int i_B_Count=0;
while(temp[i_T_Count])
{
while(temp[i_T_Count] ==' ')
{
i_T_Count++;
}
for(i_B_Count=0 ;
temp[i_T_Count] !=' ' && temp[i_T_Count]!=NULL ;
i_B_Count++)
{
buffer[i_B_Count] = temp[i_T_Count++] ;
}
buffer[i_B_Count]=NULL;
return 0;
}
return -1;
}
void main()
{
char temp[] = {" 1234 5678 9 9 9 9 "};
char buffer[1024];
while(!GetToken(temp , buffer))
printf("%s\n" , buffer);
}
[[ result ]]