FILE *fp;fp = fopen("filename.txt", "w+"); // 以写的方式打开需要写入的文本文件filenamefprintf(fp, "%d", a); // 需要保存的数据为a第一种形式: