Hi, Thanks in advanced. Specs: C, Borland Compiler, 64bit, Win7.
Short & Sweet:
Im having a strncat problem. Im using a loop to iterate through input and strncat to write two different strings based on the input. The problem is that the new strings will have some of the other characters in them.
Code:gets(string);
for( i=0; i < (int)strlen(string); ++i )
{
//if the input is a number, write it to a string named num.
if( string[i] >= 47 && string[i] <= 58)
strncat(num, &string[i], 1);
//if the input is a character, write it to a string named alpha.
else
strncat(alpha, &string[i], 1);
}
puts(num);
puts(alpha);