- 1
C program related to files..
Write a C program to create and store information in a text file?
5 odpowiedzi
+ 4
So what's the problem?create one or learn about how to create a file and store information ,there is so much information available about it on net ,
+ 1
#include <stdio.h>
int main() {
FILE *fptr;
fptr = fopen("abcd.txt", "w");
if (fptr == NULL) {
printf("Error opening file.");
return -1;
}
else{
printf(“The file abcd.txt has created successfully…!!”);
}
fclose(fptr);
return 0;
........
It's not working..why?
+ 1
printf(“The file abcd.txt has created successfully…!!“);
In this printf, you are not using double (wrong) quotes..
Corrected one:
printf("The file abcd.txt has created successfully…!!");
Other file operation is in proper way....
+ 1
Thanks..i got it..