Is there anyway to use scanf without it going to a new line when printf is invoked after it? Or if something other than printf that would work?
I want to be able to output information on the same line that the scanf function just used
Example:
The screen when you run this will be the following:
is there anyway to manipulate the scanf function so it is like this instead
I know there is gets, but i'd rather not use it as it isnt the safest in the world. (and produces annoying warnings on GCC)
thanks.
I want to be able to output information on the same line that the scanf function just used
Example:
Code:
char *str;
str = malloc(sizeof(char) * STRLENGTH);
printf("say Hello.\n");
scanf("%s", str);
if (strcmp(str, "Hello") == 0)
{
printf(" y helo thar\n");
}
The screen when you run this will be the following:
Code:
say Hello.
Hello
y helo thar
is there anyway to manipulate the scanf function so it is like this instead
Code:
say Hello.
Hello y helo thar
I know there is gets, but i'd rather not use it as it isnt the safest in the world. (and produces annoying warnings on GCC)
thanks.