[UP]


Manual Reference Pages  - system_perror (3)

NAME

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

CONTENTS

Synopsis
Description
Example

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

EXAMPLE

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!


system_perror (3) March 11, 2021
Generated by manServer 1.08 from 1b63637e-0cd1-4849-abc3-5b3b350ec1fc using man macros.