Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: Binary I/0 Up: Input and Output Previous: ASCII I/O

User Interaction

There have been many examples of printing output for the user using the print statement. You can also generate output for the user using printf. Here is an example:

    printf('The current register value is 0x%x\n',753) 
would result in the output:
    The current register value is 0x2f1
(See § 10.5.2, page [*] for a discussion of all of the options available with printf.)

You can get input from the user using the readline function. This function allows the user to enter strings to be used by a script, for example:

    print readline()
would prompt the user with >>:
    >> first string
and the string entered by the user, here first string, is returned as the result of readline(). The prompt can be changed from the default >> to something else with the prompt parameter:
    print readline(prompt='ANOTHER>> ')
In this case, ANOTHER>> is used to prompt the user. The readline function allows the user to edit the input using the same command line editing package that Glish uses to get input (See § 14, page [*]).


next up previous contents index
Next: Binary I/0 Up: Input and Output Previous: ASCII I/O   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15