Hi
I want to be able to write to a file that the user has specified the name of. This is where i am
But it either crashes, or doesnt store.Code://the rest of the program char *name[20], *filename; FILE *EulerData; scanf("%s", name); filename = ("%s.txt", name); printf("%s", filename);//just to see if the program has added the .txt for (i=0;i<100;i++) { EulerData = fopen(filename, "w"); fprintf(EulerData, "%f %f %f\n", x[i], y[i], z[i]); fclose; }
Any ideas?
P.S if you are reading from a text file, how do you check if there is nothing in it or it doesnt exist?
cheers



LinkBack URL
About LinkBacks



