xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

ACCEPT

Basic user input routine.

Syntax

ACCEPT [<xMessage>] TO <cVarName>

Arguments

<xMessage>
This is an optional expression of data type C, D, L or N. The value of <xMessage> is displayed before the user can input data.
<cVarName>
This is a character string holding the name of the variable to assign the user input to. It must be of PRIVATE or PUBLIC scope. If <cVarName> does not exist, a PRIVATE variable is created.

Description

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.

Info

See also:@...GET, @...SAY, Inkey(), INPUT, KEYBOARD
Category: Input commands
Source:rtl\accept.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe