gmp_libmpz_inp_raw Method |
Input from stdio stream
stream in the format written by
mpz_out_raw, and put the result in
rop.
Namespace:
Math.Gmp.Native
Assembly:
Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public static size_t mpz_inp_raw(
mpz_t rop,
ptr<FILE> stream
)
Public Shared Function mpz_inp_raw (
rop As mpz_t,
stream As ptr(Of FILE)
) As size_t
public:
static size_t mpz_inp_raw(
mpz_t^ rop,
ptr<FILE>^ stream
)
static member mpz_inp_raw :
rop : mpz_t *
stream : ptr<FILE> -> size_t
Parameters
- rop
- Type: Math.Gmp.Nativempz_t
The result operand. - stream
- Type: Math.Gmp.NativeptrFILE
Pointer to file stream.
Return Value
Type:
size_tReturn the number of bytes read, or if an error occurred, return 0.
Remarks
This routine can read the output from mpz_out_raw also from GMP 1,
in spite of changes necessary for compatibility between 32-bit and 64-bit machines.
Examples
mpz_t op = new mpz_t();
gmp_lib.mpz_init_set_ui(op, 123456U);
string pathname = System.IO.Path.GetTempFileName();
ptr<FILE> stream = new ptr<FILE>();
_wfopen_s(out stream.Value.Value, pathname, "w");
Assert.IsTrue(gmp_lib.mpz_out_raw(stream, op) == 7);
fclose(stream.Value.Value);
_wfopen_s(out stream.Value.Value, pathname, "r");
Assert.IsTrue(gmp_lib.mpz_inp_raw(op, stream) == 7);
fclose(stream.Value.Value);
Assert.IsTrue(gmp_lib.mpz_get_ui(op) == 123456U);
System.IO.File.Delete(pathname);
gmp_lib.mpz_clear(op);
Dim op As New mpz_t()
gmp_lib.mpz_init_set_ui(op, 123456UI)
Dim pathname As String = System.IO.Path.GetTempFileName()
Dim stream As New ptr(Of FILE)()
_wfopen_s(stream.Value.Value, pathname, "w")
Assert.IsTrue(gmp_lib.mpz_out_raw(stream, op) = 7)
fclose(stream.Value.Value)
_wfopen_s(stream.Value.Value, pathname, "r")
Assert.IsTrue(gmp_lib.mpz_inp_raw(op, stream) = 7)
fclose(stream.Value.Value)
Assert.IsTrue(gmp_lib.mpz_get_ui(op) = 123456UI)
System.IO.File.Delete(pathname)
gmp_lib.mpz_clear(op)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also