getchar(3f) - [M_io:QUERY] read a single-byte character from stdin via C interface (LICENSE:PD)
Synopsis
Description
Options
Returns
Examples
Author
License
function getchar() result(ch)
character(len=1),intent(in) :: ch integer :: getchar
Read a single character from stdin using the C interface
ch A single character to read from stdin
A integer value for the ADE (ASCII Decimal Equivalent) of the character, or a negative value if an error occurs.
sample usage
program demo_getchar use M_io, only : getchar, putchar implicit none character(len=1) :: byte integer :: istat ! copy stdin to stdout as a stream one byte at a time do while (getchar(byte).ge.0) istat=putchar(byte) enddo end program demo_getchar
John S. Urban
Public Domain
Nemo Release 3.1 | getchar (3) | February 23, 2025 |