Sting Manipulation!!Pls Help
Hello
I thought this was simple issue but then i have no clue how to
work on it.anyways...
From a file i am getting a name in to a string like
strname=tony,ledesma where "TONY" is last name
and "LEDESMA " is first name.
NOW i need to reverse the name, meaning , the output shud
display "LEDESMA TONY"(replacing the comma with a space).
I used STRTOK but was able to get only TONY...I do not want write a loop and work on this...
But is there any simple way i can solve this...
Anyhelp is appreciated...
thanks in Advance
Got the problem Solved! thanks
hello All
Thanks for everything!
Ken: I did work on your sprintf but it throwed up some errors...
Prelude:the reason why idid not want any loops b'cos there can be some string built in functions that can be used. I am comfortable with loops but this wa the reason...
Solution
1. took the name into a string using scanf...
char name[50];
char *lastname;
char * firstname;
lastname=strtok(name,"',");
firstname=strtok(NULL,','); Since all the tokens intialized are stored , this find the null value of the string seperated by a comma..
Anyhow thanks for all your help...