MPZ从十六进制转换为数字

时间:2014-03-27 03:11:56

标签: c++ hex

这是我第一次使用mpz。我正在尝试将文件基数16转换为x。例如,我想将924e6c52cd7f03abcc5e转换为数字。但我得到一个像这样的错误:gen_key.cpp(.text + 0x29):我试图使用gmpz的所有时间都未定义引用'__gmpz_init'。我在下面提供了我的代码,并感谢任何帮助。

using namespace std;
#include <iostream>
#include "gmp.h"
#include "gmpxx.h"
#include <cstdio>
#include <cstdlib>
#define CHUNK 10 //for remainder

//for now won't worry about command line but should come back later and do that !!!
int main(int argc, char** argv)
{

FILE *fp;
fp = fopen("cipher_text", "rt");   
mpz_t x;

mpz_init(x); 



    mpz_inp_str(x, fp, 16);   
    mpz_out_str(stdout,10,x);
 mpz_clear(x);   



return 0;
}

0 个答案:

没有答案