View Single Post
Old 10-26-2006, 01:35 PM   #5 (permalink)
Deliverance
C++ Beginner
 
Join Date: Jul 2005
Location: Ottawa
Posts: 73
Deliverance is on a distinguished road
Neeven:
Try out the isspace() function
#include <ctype.h>
int j;
int isspace(int c);

isspace will test for a character that is a standard whitespace (space,tab,return,newline,vertical tab,etc).

return: returns non-zero for true, 0 for false.

should be pretty simple to implement in your code, try something like this:
Code:
if ((j = isspace(c)) == -1)
    break;
else
    name[i] = name[i] + 1;
similarly i'm pretty sure there is an isalpha() which behaves the same way to ensure you are not changing special symbols...


see http://www-ccs.ucsd.edu/c/ctype.html for more information on all the functions you can use with ctype

Last edited by Deliverance; 10-26-2006 at 01:40 PM. Reason: just to add a little snippet...
Deliverance is offline   Reply With Quote