I want to write this program which takes user input for filename and also the string input to write the data into the file.
The program successfully takes file name as input but when it takes the string to be written as input it just skips it and completes execution
#include <conio.h>
int main()
{
FILE *filepointer;
printf("Enter file name with extension:\n");
char name[100];
scanf("%s",&name);
filepointer = fopen(name,"w");
char str[1024];
printf("Enter what you want to write\n");
gets(str); //This is not taking input
fprintf(filepointer,"%s",str);
return 0;
}```