Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

GETC

Portability Function: Reads the next available character from external unit 5, which is normally connected to the console.

Module

USE IFPORT

result = GETC (char)

char

(Output) Character*(*). First character typed at the keyboard after the call to GETC. If unit 5 is connected to a console device, then no characters are returned until the Enter key is pressed.

Results

The result type is INTEGER(4). The result is zero if successful, or -1 if an end-of-file was detected.

Example

    use IFPORT
    character ans,errtxt*40
    print *, 'Enter a character: '
    ISTAT = GETC (ans)
  if (istat) then
    call gerror(errtxt)
  end if

See Also