Since you are pretty much using stdin for input you can opt for gets(), Usage:
char st[50]; gets(st);
However fgets has a little advantage since it can limit the number of input characters.
Hope thats clear to you.
OP wanted to input a file name only, gets() should work fine for him
int main()
{
char str[10];
printf("Enter file name\n");
gets(str);
printf("File name is %s\n",str);
return 0;
}
This is a short stub which accepts the file name from the user. Are you actually saying its fine to use gets here ?