I am supposed to use get the user input of a filename and then open that file and print to the screen (the first line-- that I will do later), and I can't figure out what I am doing wrong. Thank you.
#include <stdio.h>
main()
{
char s[1000];
printf("Enter the filename to open: ");
FILE *fr;
fgets(s, 81, fr);
fr = fopen("s", "r");
if (!fr)
return 1;
while (fgets(s,1000, fr)!=NULL)
fprintf(fr,"%s\n",s);
fclose(fr);
return 0;
}