I am trying to let the user to save with a custom name but it doesn't seem to work, When I hard code it, it is fine and works but not the other way around.
char name[100];
printf("\nEnter File name to save the file: ");
fgets(name, 100, stdin);
FILE *fLocation = fopen(name, "a+");//I can just put the complete path and name and it works
if (fLocation == NULL){
printf("Error, could't create the file\n");
return;
}