if u want to create a file using a variable by taking its value from input data file,then your code should be in this pattern.
char ch[10];/*say input.dat contains data as 'output'*/
FILE*fp,*ft;
fp=fopen("input.dat","r");/*fp is input file pointer*/
if(fp==NULL)
{
puts("error")
}
while(fscanf(fp,"%s",&ch)!=EOF);
printf("%s",ch);
sscanf or sprintf(ch,"%s.txt",ch);
ft=fopen(ch,"w");
if(ft==NULL)
{
puts("error");
}
fclose(fp);
fclose(ft);