摘要: 分三块来讲述: 1 首先://注意在C和C++里不同 在C中定义一个结构体类型要用typedef: typedef struct Student { int a; }Stu; 于是在声明变量的时候就可:Stu stu1;(如果没有typedef就必须用struct Student stu1;来声明) 这里的Stu实际上就是struct Student的别名。Stu==struct Student 另外这里也可以不写Student(于是也不能struct Student stu1;了,必须是Stu stu1;) typedef struct... 阅读全文
posted @ 2013-07-27 23:08 Geekers 阅读(217) 评论(0) 推荐(0) 编辑
摘要: FILE* pfile=fopen("dict.txt","r"); while (!feof(pfile)){fscanf(pfile,"%s",name[i]);++i;}这里的 feof是一个函数feof(fp)有两个返回值:如果遇到文件结束,函数feof(fp)的值为非零值,否则为0。feof(file stream )文件指针到达文件末尾!feof(fp) 表示没有到达末尾 FILE* pfile=fopen("dict.txt","r");//这里先用fopen打开一个文件 whil 阅读全文
posted @ 2013-07-27 21:16 Geekers 阅读(899) 评论(0) 推荐(0) 编辑