- 1

C program related to files..

Write a C program to create and store information in a text file?

5th May 2020, 4:22 PM
Gaja Lakshmi.J
Gaja Lakshmi.J - avatar
4 ответов
+ 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 ,
5th May 2020, 4:25 PM
Abhay
Abhay - avatar
+ 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?
5th May 2020, 4:53 PM
Gaja Lakshmi.J
Gaja Lakshmi.J - avatar
+ 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....
5th May 2020, 6:28 PM
Jayakrishna 🇮🇳
+ 1
Thanks..i got it..
6th May 2020, 6:12 AM
Gaja Lakshmi.J
Gaja Lakshmi.J - avatar