gmp_libmpz_inp_str Method |
Input a possibly white-space preceded string in base base from stdio stream stream, and put the read integer 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_str(
mpz_t rop,
ptr<FILE> stream,
int base
)
Public Shared Function mpz_inp_str (
rop As mpz_t,
stream As ptr(Of FILE),
base As Integer
) As size_t
public:
static size_t mpz_inp_str(
mpz_t^ rop,
ptr<FILE>^ stream,
int base
)
static member mpz_inp_str :
rop : mpz_t *
stream : ptr<FILE> *
base : int -> size_t
Parameters
- rop
- Type: Math.Gmp.Nativempz_t
The result integer. - stream
- Type: Math.Gmp.NativeptrFILE
Pointer to file stream. - base
- Type: SystemInt32
The base operand.
Return Value
Type:
size_tReturn the number of bytes read, or if an error occurred, return 0.
Remarks
The base may vary from 2 to 62, or if base is 0,
then the leading characters are used: 0x and 0X for hexadecimal,
0b and 0B for binary, 0 for octal, or decimal otherwise.
For bases up to 36, case is ignored; upper-case and lower-case letters have the same value.
For bases 37 to 62, upper-case letter represent the usual 10..35 while
lower-case letter represent 36..61.
Examples
mpz_t op = new mpz_t();
gmp_lib.mpz_init(op);
string pathname = System.IO.Path.GetTempFileName();
System.IO.File.WriteAllText(pathname, "123456");
ptr<FILE> stream = new ptr<FILE>();
_wfopen_s(out stream.Value.Value, pathname, "r");
Assert.IsTrue(gmp_lib.mpz_inp_str(op, stream, 10) == 6);
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(op)
Dim pathname As String = System.IO.Path.GetTempFileName()
System.IO.File.WriteAllText(pathname, "123456")
Dim stream As New ptr(Of FILE)()
_wfopen_s(stream.Value.Value, pathname, "r")
Assert.IsTrue(gmp_lib.mpz_inp_str(op, stream, 10) = 6)
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