Programming - cpueblo.com

TRIM 함수의 구현


글쓴이 : 유광희 날짜 : 2002-10-12 (토) 14:16 조회 : 6142


char* trim(char* buf, int size)
{
	char *temp = new char[size];
	memset(temp, 0, size);

	int j = 0;
	for(int i=0; iif(buf[i] != ' ')
		temp[j++] = buf[i];
	}

	strcpy(buf, temp);
	delete temp;

	return buf;
}