回复 10楼 寒风中的细雨
还是不行,依然是失败啊。。。。。
程序代码:
#include <stdio.h> #include <string.h> char *a[5][2]= { "11_c", "12_c", "13_c", "14_c", "15_c", "16_c", "17_c", "18_c", "19_c", "20_c", }; void save(void) { FILE *fp=NULL; int i, ret_code; ret_code = fopen_s(&fp, "d:\\arr.dat", "w"); if (0 != ret_code) { printf ("\t打开文件失败!\n"); return; } for (i=0; i<5; ++i) { fwrite(a[i][0], strlen(a[i][0]), 1, fp); fwrite(a[i][1], strlen(a[i][1]), 1, fp); } fclose(fp); } int print(void) { FILE *fp=NULL; int ret_code; ret_code = fopen_s(&fp, "d:\\arr.dat", "r"); if (0 != ret_code) { printf ("\t打开文件失败!\n"); return -1; } while (0 == feof(fp)) { printf("%c", fgetc(fp)); } fclose(fp); printf("\n"); return 0;//success } int main(void) { save(); print(); return 0; }