Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Fortran

Idiom #59 Write to standard error stream

Print the message "x is negative" to standard error (stderr), with integer x value substitution (e.g. "-2 is negative").

program write_to_stderr
   use iso_fortran_env, only : stderr=>ERROR_UNIT   
   implicit none
   integer :: x=-2
   write(stderr,'(i0," is negative")') x
end program write_to_stderr
with Ada.Text_IO;
use Ada.Text_IO;
Put_Line (Standard_Error, Integer'Image (X) & " is negative");

New implementation...
< >
programming-idioms.org