perror(3f) - [M_system:ERROR_PROCESSING] print error message for last C error on stderr (LICENSE:PD)
Synopsis
Description
Examples
subroutine system_perror(prefix)
character(len=*),intent(in) :: prefix
Use system_perror(3f) to print an error message on stderr corresponding to the current value of the C global variable errno. Unless you use NULL as the argument prefix, the error message will begin with the prefix string, followed by a colon and a space (:). The remainder of the error message produced is one of the strings described for strerror(3c).
Sample program:
program demo_system_perror use M_system, only : system_perror,system_rmdir implicit none character(len=:),allocatable :: DIRNAME DIRNAME=/NOT/THERE/OR/ANYWHERE ! generate an error with a routine that supports errno and perror(3c) if(system_rmdir(DIRNAME).ne.0)then call system_perror(*demo_system_perror*://DIRNAME) endif write(*,(a))"Thats all Folks!" end program demo_system_perrorExpected results:
*demo_system_perror*:/NOT/THERE/OR/ANYWHERE: No such file or directory Thats all Folks!
Nemo Release 3.1 | system_perror (3m_system) | March 07, 2025 |