Thomas Luthe wrote:
The manual only states that the string must contain exactly one number if end_of_parse is null, which it is not in my example. In the non-null case read_integer itself checks the end of the integer input and stores the position of the character after the integer in *end_of_parse. This works as expected for any non-integer characters like +,*,-,... with / being the only exception.
What you say is clearly a desirable behaviour of the read_integer function. However, I don't know whether read_integer can easily be changed to operate this way: the rational number and complex number readers possibly depend on the present behaviour. Also, the comments in <cln/integer_io.h> say read_integer is "undocumented" and that it "does strictly the same as the general read_complex". So, the relation between read_integer and the other readers is not clear to me. Therefore I agree with Richy, better pre-parse the string yourself, and use read_integer only for the second, number-crunching, phase. Bruno