fopen en c code example
Example 1: fopen function in c
#include<stdio.h>
#include<conio.h>
void main(){
FILE *fp;
//r means read file
fp=fopen("sam.txt","r");
fclose(fp);
getch();
}
Example 2: c fopen
#include <stdio.h>
#include <stdlib.h>
int main () {
FILE * fp;
fp = fopen ("file.txt", "w+");
fprintf(fp, "%s %s %s %d", "We", "are", "in", 2012);
fclose(fp);
return(0);
}
Example 3: fopen c
FILE *fopen(const char *filename, const char *mode)