Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - accept place keyboard input to string variable http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 accept              Place keyboard input to string variable
------------------------------------------------------------------------------
 Syntax
   accept [cPrompt] to cVar

 Arguments
   cPrompt is an optional message to display.
   cVar is a character variable that receives user input.

 Description
   The accept command displays an optional prompt and then allows for
   keyboard input which will be assigned to the variable cVar.

   A carriage return is printed before the prompt and/or keyboard input
   unless the Force variable __cr_first is .f.. The carriage return and the
   optional prompt are displayed through the same I/O system as the ?
   command.

   cVar cannot be a field variable. Editing can occur up to the declared
   length of cVar.

   The accept and input commands share a line-based keyboard input routine.
   The processed keys are listed in the Accept/input key table.

 Example
   #define EXAMPLE_IO
   #include example.hdr

   proc Test_accept
   vardef
       char     cInput
   enddef
   // Get a name into a character variable, cInput
   accept "Input name: " to cInput
   ? cInput
   // Get the name, without a prompt.
   accept to cInput
   ? cInput
   // Set the cursor to 16, 5 and then get input
   @ 16, 5
   __cr_first := .f.
   accept "Prompt is at 16, 5: " to cInput
   ? cInput
   endproc

   proc main
   Test_accept()
   endproc

See Also: Accept/input key table input

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson