Tuesday, July 14, 2009

How to open a file with a c program.?

Ok I tried fopen to open a file called file1.txt, but it said file1 is undeclared or something like that. What's the proper code to open a file in C (if I want to open file1.txt)?

How to open a file with a c program.?
just declare a file pointer for eg FILE* f ,then





f=fopen("drive letter:\file1.txt","mode");





mode work


"a" append can make changes at the end of file


"r" read you can just read the file cant chang in this mode


"w" write you can write any where in your file


No comments:

Post a Comment