gmp_libgmp_vfprintf Method |
Namespace: Math.Gmp.Native
public static int gmp_vfprintf( ptr<FILE> fp, string fmt, params Object[] ap )
Public Shared Function gmp_vfprintf ( fp As ptr(Of FILE), fmt As String, ParamArray ap As Object() ) As Integer
public: static int gmp_vfprintf( ptr<FILE>^ fp, String^ fmt, ... array<Object^>^ ap )
static member gmp_vfprintf : fp : ptr<FILE> * fmt : string * ap : Object[] -> int
// Create unique file pathname and a file pointer. string pathname = System.IO.Path.GetTempFileName(); ptr<FILE> stream = new ptr<FILE>(); mpz_t z = "123456"; mpq_t q = "123/456"; mpf_t f = "12345e6"; mp_limb_t m = 123456; // Open file stream and print to it. _wfopen_s(out stream.Value.Value, pathname, "w"); Assert.IsTrue(gmp_lib.gmp_vfprintf(stream, "%Zd - %QX - %Fa - %Mo", z, q, f, m) == 42); fclose(stream.Value.Value); Assert.IsTrue(System.IO.File.ReadAllText(pathname) == "123456 - 7B/1C8 - 0x2.dfd1c04p+32 - 361100"); // Release unmanaged memory. gmp_lib.mpz_clear(z) gmp_lib.mpq_clear(q) gmp_lib.mpf_clear(f)
' Create unique file pathname and a file pointer. Dim pathname As String = System.IO.Path.GetTempFileName() Dim stream As New ptr(Of FILE)() Dim z As mpz_t = "123456" Dim q As mpq_t = "123/456" Dim f As mpf_t = "12345e6" Dim m As mp_limb_t = 123456 ' Open file stream and print to it. _wfopen_s(stream.Value.Value, pathname, "w") Assert.IsTrue(gmp_lib.gmp_vfprintf(stream, "%Zd - %QX - %Fa - %Mo", z, q, f, m) = 42) fclose(stream.Value.Value) Assert.IsTrue(System.IO.File.ReadAllText(pathname) = "123456 - 7B/1C8 - 0x2.dfd1c04p+32 - 361100") ' Release unmanaged memory. gmp_lib.mpz_clear(z) gmp_lib.mpq_clear(q) gmp_lib.mpf_clear(f)
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.