ok i have incoorperated fgets(). AND IT WOKRED!!! but now i want to add soemthing where the user choses the name of the .html file. i have tried this, but it doesnt work, can someine help me imorove this code??
Code:
#include <stdio.h>
#include <string.h>
FILE * tvFile;
int main()
{
char fileName;
char buf[BUFSIZ];
char *p;
printf("what do you want the .html file to be saved as?");
if (fgets(fileName, sizeof(fileName), stdin) != NULL)
{tvFile = fopen("c:\\>%s<.html",fileName, "w");
char buf[BUFSIZ];
char *p;
printf ("please enter your html, it will be saved to c://program, max%d characters\n", sizeof(buf));
if (fgets(buf, sizeof(buf), stdin) != NULL)
{
printf ("Thank you, you entered >%s<\n", buf);
fprintf(tvFile,"%s", buf);
fclose(tvFile);
}
return 0;
}
Thanks again!