摘要: /* 8.8从文件ex88_1.txt中取出成绩,排序后,按降序存放EX88_2.TXT中 */ #include "stdio.h" #define N 10 struct student { int num; char name[20]; int score[3]; /*不能使用float*/ float average; }; void sort(struct stude... 阅读全文
posted @ 2008-05-18 20:20 emanlee 阅读(1360) 评论(2) 推荐(0) 编辑
摘要: /* 8.5 从键盘输入一行字符,将其中小写字母转换为大写字母 */ #include "stdio.h" void main() { FILE *fp; char ch; if((fp=fopen("c:\\ex85.txt","w"))==NULL) { printf("不能创建文件c:\\ex85.txt"); exit(1);... 阅读全文
posted @ 2008-05-18 20:20 emanlee 阅读(1599) 评论(0) 推荐(0) 编辑
摘要: 文件操作函数 C语言 (FILE fputc fgetc fputs fgets fscanf fprintf) 在ANSI C中,对文件的操作分为两种方式,即流式文件操作和I/O文件操作,下面就分别介绍之。 一、流式文件操作 这种方式的文件操作有一个重要的结构FILE,FILE在stdio.h中定义如下: typedef struct { int level; /* fill/empty ... 阅读全文
posted @ 2008-05-18 20:18 emanlee 阅读(6168) 评论(0) 推荐(0) 编辑