Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
mpz_t 型の変数を char* に変換する方法がわかりません。多くの関数を試しましたが、char* は空のままです。
B 変数を出力できます。
mpz_t B; gmp_printf("B: %Zx\n", B);
しかし、その B 変数を char* に変換する方法は?
あなたが望むように見えmybuffer = mpz_get_str(NULL, /*base*/10, B);ます。(返されたバッファを割り当てます。必要に応じて、既存のバッファに書き込むこともできます。必要なサイズの計算方法については、マニュアルを参照してください。)
mybuffer = mpz_get_str(NULL, /*base*/10, B);
gmp_sprintf(array, "%Zx", B);