system_getchar(3f) - [M_system:IO] reads a character from the stdin stream. (LICENSE:PD)
Synopsis
Description
Return Value
Examples
integer(kind=c_int) function system_getchar(ch)
character(len=1),intent(out) :: ch
system_getchar(3f) read the character CH from the stdin stream via C I/O.
If an error occurs the return value is negative. Otherwise getchar(3C) returns the character read as a default integer value that is the ADE (ASCII Decimal Equivalent) of the character.In addition, the option CH contains the character read.
Example program
program demo_system_getchar use M_system, only : system_getchar, system_putchar implicit none character(len=1) :: ch integer :: iostat integer :: icount icount=0 ! copy first 1024 characters from stdin to stdout do while(system_getchar(ch).ge.0) iostat=system_putchar(ch) icount=icount+1 if(icount > 1024 ) exit enddo end program demo_system_getchar
Nemo Release 3.1 | system_getchar (3m_system) | March 07, 2025 |