The file is created, but the function WriteFile can't write in the file, I need to create the file in a function not in the main.
#include <stdio.h>
#include <stdlib.h>
void CreateFile(FILE *file){
file = fopen("file.txt","w");
if(file == NULL){
printf("Error : Could not create the file");
}
}
void WriteFile(FILE *file){
fprintf(file,"Hello !");
}
int main()
{
FILE *file = NULL;
CreateFile(file);
WriteFile(file);
fclose(file);
return 0;
}