1#include<stdio.h>
2#include<conio.h>
3void main(){
4 FILE *fp;
5 //r means read file
6 fp=fopen("sam.txt","r");
7 fclose(fp);
8 getch();
9}
1#include <stdio.h>
2#include <stdlib.h>
3
4int main () {
5 FILE * fp;
6
7 fp = fopen ("file.txt", "w+");
8 fprintf(fp, "%s %s %s %d", "We", "are", "in", 2012);
9
10 fclose(fp);
11
12 return(0);
13}