求助,一个c程序,十进制转换二进制!
为什么输出的out.txt文件不是二进制文件呢?
#include "stdafx.h"
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char* argv[])
{
FILE *fp;
fp = fopen("wm_model_data3_20060912_08","rb");
FILE *fout;
fout = fopen("out.txt","wb");
double tmp[20];
int i;
while(!feof(fp))
{
for(i=0;i<10;i++)
{
if(fscanf(fp,"%lf",&tmp[i]) < 0 )
break;
fprintf(fout,"%13f",tmp[i]);
if(i == 9) fprintf(fout,"\n"); //一行10个数
}
}
fclose(fp);
return 0;
}