jeudi 30 avril 2015

How to create a file and to give it name at the same time

I am having a problem with this C code. I am creating a file and I want to give it a name at the same time. But something is not working - it won´t create this file with the chosen name. The rest of the code works fine btw.

FILE *InputRef;                                            

char outputFilename[];                   // Creates a char
printf("Enter the name of your file");   // It asks for a name
outputFilename=getchar();   // And here I want to enter the file name

InputRef = fopen(outputFilename, "w"); // 

Aucun commentaire:

Enregistrer un commentaire