DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(gmp.info.gz) I/O of Integers

Info Catalog (gmp.info.gz) Integer Logic and Bit Fiddling (gmp.info.gz) Integer Functions (gmp.info.gz) Integer Random Numbers
 
 Input and Output Functions
 ==========================
 
 Functions that perform input from a stdio stream, and functions that
 output to a stdio stream.  Passing a `NULL' pointer for a STREAM
 argument to any of these functions will make them read from `stdin' and
 write to `stdout', respectively.
 
    When using any of these functions, it is a good idea to include
 `stdio.h' before `gmp.h', since that will allow `gmp.h' to define
 prototypes for these functions.
 
  - Function: size_t mpz_out_str (FILE *STREAM, int BASE, mpz_t OP)
      Output OP on stdio stream STREAM, as a string of digits in base
      BASE.  The base may vary from 2 to 36.
 
      Return the number of bytes written, or if an error occurred,
      return 0.
 
  - Function: size_t mpz_inp_str (mpz_t ROP, FILE *STREAM, int BASE)
      Input a possibly white-space preceded string in base BASE from
      stdio stream STREAM, and put the read integer in ROP.
 
      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.
 
      Return the number of bytes read, or if an error occurred, return 0.
 
  - Function: size_t mpz_out_raw (FILE *STREAM, mpz_t OP)
      Output OP on stdio stream STREAM, in raw binary format.  The
      integer is written in a portable format, with 4 bytes of size
      information, and that many bytes of limbs.  Both the size and the
      limbs are written in decreasing significance order (i.e., in
      big-endian).
 
      The output can be read with `mpz_inp_raw'.
 
      Return the number of bytes written, or if an error occurred,
      return 0.
 
      The output of this can not be read by `mpz_inp_raw' from GMP 1,
      because of changes necessary for compatibility between 32-bit and
      64-bit machines.
 
  - Function: size_t mpz_inp_raw (mpz_t ROP, FILE *STREAM)
      Input from stdio stream STREAM in the format written by
      `mpz_out_raw', and put the result in ROP.  Return the number of
      bytes read, or if an error occurred, return 0.
 
      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.
 
Info Catalog (gmp.info.gz) Integer Logic and Bit Fiddling (gmp.info.gz) Integer Functions (gmp.info.gz) Integer Random Numbers
automatically generated byinfo2html