Manual Reference Pages  - system_perror (3m_system)

NAME

perror(3f) - [M_system:ERROR_PROCESSING] print error message for last C error on stderr (LICENSE:PD)

CONTENTS

Synopsis
Description
Examples

SYNOPSIS

subroutine system_perror(prefix)

     character(len=*),intent(in) :: prefix

DESCRIPTION

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).

EXAMPLES

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)’)"That’s all Folks!"
   end program demo_system_perror

Expected results:

   *demo_system_perror*:/NOT/THERE/OR/ANYWHERE: No such file or directory
   That’s all Folks!


Nemo Release 3.1 system_perror (3m_system) March 07, 2025
Generated by manServer 1.08 from 60272abd-ad38-4a05-9531-ee35a1f8ad27 using man macros.