Skip to content

Commit c48e7e0

Browse files
committed
new file: file.txt
new file: main.c
1 parent 21c3c20 commit c48e7e0

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

c/fileio/.file.txt.swp

12 KB
Binary file not shown.

c/fileio/file.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
123 456
2+
789
3+
012

c/fileio/main.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
int main()
4+
{
5+
FILE *fp;
6+
char str1[100],str2[100],str3[100],str4[100];
7+
int a;
8+
//fp = fopen("file.txt", "w");
9+
10+
//fprintf(fp, "%s", "this is an apple");
11+
//fclose(fp);
12+
fp = fopen("file.txt", "r");
13+
fscanf(fp,"%s %s %s %s",str1,str2,str3,str4);
14+
printf("%s %s %s %s",str1,str2,str3,str4);
15+
fclose(fp);
16+
return(0);
17+
}

0 commit comments

Comments
 (0)