#include
void main()
{
char file[256], str[4096], path[256], ch;
FILE *fp;
printf("please input filename:");
scanf("%s", file);
while(ch = getchar() != '\n' && ch != EOF);
sprintf(path, "D:/%s.txt", file);
printf("please input string:");
gets(str);
fp = fopen(path, "w");
if(fp==NULL)
{
printf("Can't open the file <%s>\n", path);
return ;
}
fputs(str, fp);
fclose(fp);
}