PDA

View Full Version : Input


Xiang
04-26-2003, 07:58 PM
Dear sir,
Refers to the below coding. In my input condition, I want to able the cursor move arround the name and do the amendment. How can I do??? I have try gets function before, but it does't work.

For example,
If user has entered "Dsvid Jackson", he want to amend the second character "s" to "a". If I used scanf function, it will erase other characters until the "s" location is meet. How can I enable the cursor move to the "s" location to do the amendment and also retain the other characters.

char name[10];

printf("Enter your name: ");
scanf("%s", name);
printf("%s", name);


Best regards,

Xiang

Phantom
04-27-2003, 04:01 PM
printf("enter your name: ");
gets(name); /* just like getc, only stores input in a string format */
if(char[1] == s) {
char[1] = a; /* char[1] is the second character - the "s" */
}