Singular
https://www.singular.uni-kl.de/forum/

User Input
https://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=1623
Page 1 of 1

Author:  vinay [ Tue Dec 19, 2006 5:21 pm ]
Post subject:  User Input

I would just like to know how to take user input for the running Singular process. Let me make it more clear:
e.g. In most of the programs, we need something like this:
Code:
"Please enter value of x":
get_user_input(x)
do_some_process(x)
produce_output()
$

The best possible way I can see as of now is to write some C (or similar) wrapper code which will ask such questions and get the inputs, then store them in some temp text file, come back to Singular process, ask Singular to read that text file and delete it after you are done.

Please let me know, is there any other way within Singular itself?

With Regards

VInay Wagh

Author:  hannes [ Mon Jan 08, 2007 8:45 pm ]
Post subject:  Re: User input

To get user input from a Singular procedure
you should use the read command:
string s=read(""); // the empty string refers to the user keyboard
This call will return exactly one line of user input as an unchanged string.

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/