I meant fgets, sorry. My plan is this: I got a lot of files in a directory and some of the file names have mistakes(like a character should be lower case). I want the program to show me the name of...
Type: Posts; User: TKMan
I meant fgets, sorry. My plan is this: I got a lot of files in a directory and some of the file names have mistakes(like a character should be lower case). I want the program to show me the name of...
Hi,
I want to write a programm that does this:
1.Find the first file in the directory
2.print its name into a input field
3.rename the file
Then the same procedure happens with the second...
Ok, thanks now I understood it.
But if I use scanf it can always happen that there will be chars left in stdin. Can could I prevent this with scanf or do I have to use another function?
how would you flush stdin?
while ((ch = getchar()) != '\n' && ch != EOF);
I took this loop from the faq on this forum, so I guess itīs correct... So do you know a function that inserts chars into stdin?
void flush_stdin(void)
{
char ch = 0;
while ((ch = getchar()) != '\n' && ch != EOF);
}
This code would always work if you could insert a char into stdin before the loop. Is this possible...