GMP从文件中接收浮点数/将浮点数输出到文件

哪位大神能帮忙那个写一个范例程序,GMP从文件中接收浮点数/将浮点数输出到文件,最好使用c++

就是GMP里面的gmp_fprintf和gmp_fscanf到底应该怎么用呢?

已经解决了

#include <iostream>

#include <fstream>

#include <string>

#include <gmp.h>

#include <gmpxx.h>

#include <stdio.h>


using namespace std;


int main()

{

FILE *fp;


errno_t err;

err = fopen_s(&fp,"test.txt", "w+");


//将x写入文件

mpf_class x=1.5;

int i=gmp_fprintf(fp,"%Ff",x.get_mpf_t());


if (i == -1)

cout << "gmp_fprintf发生错误!" << endl;


fclose(fp);

return 0;

}

为什么生成的test.txt文件中没有值呢?