Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: User Input
PostPosted: Tue Dec 19, 2006 5:21 pm 

Joined: Sat Oct 01, 2005 11:40 am
Posts: 40
Location: IIT Guwahati, Guwahati, Assam, INDIA
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: User input
PostPosted: Mon Jan 08, 2007 8:45 pm 

Joined: Wed May 25, 2005 4:16 pm
Posts: 275
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

It is currently Fri May 13, 2022 10:56 am
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group