Input()

Syntax

String$ = Input()
Description
Allows the program to catch an entire line of characters. This function locks the program execution and waits until the user presses the return key.

Parameters

None.

Return value

Returns the string that the user entered before pressing the return key.

Remarks

If the console is in graphical mode (see EnableGraphicalConsole()), the line can't be longer than the console width (no more keys are accepted when the line gets too long).

In non-graphical mode, a special return-value of #PB_Input_Eof (equals Chr(4)) will be received if the user enters a single Ctrl+D in the console, or a file that has been redirected to the programs input has reached its end. For compatibility with other console applications on Windows, #PB_Input_Eof is also received when Ctrl+Z is entered in the console.

If not line based or raw input is needed, ReadConsoleData() can be used in non-graphical mode.

Example

  If OpenConsole()
    Print("Enter your name and press return: ")
    Name$ = Input()
    
    PrintN("Hello " + Name$ + ", nice to meet you.")
    PrintN("Press return to exit")
    Input()
  EndIf

See Also

Inkey(), RawKey()

Supported OS

All

<- Inkey() - Console Index - OpenConsole() ->