你的数据是n行,每行数据间是一个空格隔开,并且末尾不要有空格!!!末尾是换行符。而且每行都要有数据,最好不要空出某行,不要空出第一行。
FILE* output = NULL;
fopen_s(&output, outFielName, "w");
fseek(fp, 0, SEEK_END);
long fsize = ftell(fp);
fseek(fp, 0, SEEK_SET);
VelHeader velHeaderInfo;
int index = 0;
double dep = readdouble8(fp);
fprintf(output, "%.5lf ", dep);
while (!feof(fp))
{
if (index != 0)
{
double dep = readdouble8(fp);
fprintf(output, "\n%.5lf ", dep);
}
for (int j = 0; j < nwf_L; j++)
{
long remaining = fsize - ftell(fp) ;
if (remaining <= 266)
{
const int size = remaining;
char* buff = (char*)alloca(remaining * sizeof(char)) ;
int len = fread(buff, 1, remaining, fp);
for (int i = 0; i < len; i++) {
printf("%02x ", buff[i]);
}
char t;
while (fscanf_s(fp, "%c", &t) != EOF) {
std::cout << "." << t;
}
return;
}
else
{
float velo = readfloat4(fp);
if (j == nwf_L - 1)
{
fprintf(output, "%.5f", velo);
}
else
{
fprintf(output, "%.5f ", velo);
}
}
}
index++;
}
fclose(fp);
fclose(output);