how to read string numbers at runtime into cl_I type
I have a text file like this: 16 8534483450280192 17 236164889075956560 18 -2445879764812789440 19 14227278615873217344 ... Integer paired with a very large integer. How do I read in from a file to store the big integer in a cl_I type. I tried reading it in as a string, and then I couldn't convert from a string to any of the types (cl_R, or cl_I). Eventually I'll need it to be a float, which I should be able to use cl_float() to convert from an exact type. Thanks Josh -- Joshua Friedman PhD CrownEagle@gmail.com http://www.math.sunysb.edu/~joshua
Hi Joshua,
I couldn't convert from a string to any of the types (cl_R, or cl_I).
Which of the conversion functions listed in the manual, section "Input functions" [1], did you try, and how? Bruno [1] http://www.ginac.de/CLN/cln_5.html#SEC46
Bruno In the manual it says: cl_I order_of_rubiks_cube_group = "43252003274489856000"; so I declared a string, S, read it from a file, and then I said cl_I = S; I also tried cl_I = cl_I(S), but it did not work. I assume because the string is dynamic there is a problem. I could not find the correct function or class constructor that takes a string. Here is the error: In function ‘int main(int, char**)’: e.cc:75: error: conversion from ‘std::string’ to non-scalar type ‘cln::cl_I’ requested make: *** [e.o] Error On Sun, Jul 18, 2010 at 6:26 PM, Bruno Haible <bruno@clisp.org> wrote:
Hi Joshua,
I couldn't convert from a string to any of the types (cl_R, or cl_I).
Which of the conversion functions listed in the manual, section "Input functions" [1], did you try, and how?
Bruno
-- Joshua Friedman PhD CrownEagle@gmail.com http://www.math.sunysb.edu/~joshua
Joshua Friedman wrote:
In the manual it says: cl_I order_of_rubiks_cube_group = "43252003274489856000"; so I declared a string, S, read it from a file, and then I said
cl_I = S; I also tried cl_I = cl_I(S),
but it did not work. I assume because the string is dynamic there is a problem. I could not find the correct function or class constructor that takes a string.
Here is the error: In function ‘int main(int, char**)’: e.cc:75: error: conversion from ‘std::string’ to non-scalar type ‘cln::cl_I’ requested make: *** [e.o] Error
Use the member function c_str() of class std::string to convert it to a const char*. -richy. -- Richard B. Kreckel <http://www.ginac.de/~kreckel/>
participants (3)
-
Bruno Haible
-
Joshua Friedman
-
Richard B. Kreckel