Austyn Krutsinger writes:
Where does it make the most sense to check an input string coming from a
file stream? I think we just read in the stream into a buffer skipping
spaces and tabs then stop reading the string on the End Of File (for file
streams) or a newline
Where does it make the most sense to check an input string coming from a
file stream? I think we just read in the stream into a buffer skipping
spaces and tabs then stop reading the string on the End Of File (for file
streams) or a newline '\n' (for stdin). This way the only duplicate code is
the
How about simply doing something like this:
mpz_inp_str (...)
{
1. check base, ungetc proper digit
for (...)
{
c = fgetc (...)
d = convert_to_digit_value(c, base)
if non-digit
break
mpz_mul_ui (x, x, base)
mpz_add_ui (x, x, d)
}
}
I haven't
On Wed, Jul 6, 2016 at 1:41 PM, Niels Möller wrote:
> Austyn Krutsinger writes:
>
> > I am not sure if there was a reason FILE streams were not implemented
> > before, but if there is I'd be interested in hearing why.
>
> mpz_out_str is included in
Austyn Krutsinger writes:
> I am not sure if there was a reason FILE streams were not implemented
> before, but if there is I'd be interested in hearing why.
mpz_out_str is included in mini-gmp, so it would make sense to also
include the companion function mpz_inp_str.
I appreciate all of the effort that the community has put into
complementing the gmp library with mini-gmp. I was using mini-gmp a couple
days ago and wanted to read in a number from a FILE stream and noticed that
the mpz_inp_str function wasn't available in mini-gmp, so I added it.
I'd ask that