| xHarbour Reference Documentation > Command Reference |
![]() |
![]() |
![]() |
Basic user input routine.
ACCEPT [<xMessage>] TO <cVarName>
The ACCEPT command exists for compatibility reasons only. It is a very basic text-mode command that accepts user input to be assigned as a character string to a single memory variable.
During user input only the Return key is recognized as termination key. The Escape key does not terminate the ACCEPT command.
| See also: | @...GET, @...SAY, Inkey(), INPUT, KEYBOARD |
| Category: | Input commands |
| Source: | rtl\accept.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example shows a simple command line utility used to
// count the lines in an ASCII file. Note the PARAMETERS
// statement: it declares a parameter of PRIVATE scope for Main().
PROCEDURE Main
PARAMETERS cFileName
IF Empty( cFileName )
ACCEPT "Enter a file name: " TO cFileName
ENDIF
IF Empty( cFileName )
? "User aborted"
ELSEIF .NOT. File( cFileName )
? "File not found:", cFileName
ELSE
? "Line count:", LTrim( Str( FLineCount( cFileName ) ) )
ENDIF
RETURN
http://www.xHarbour.com