file.write((char*)&a, sizeof(double));

已知double a ; ofstream file valuedat ios_basebinary ; 如将变量a写入二进制文件valuedat则应使用 完成。