We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 522f35e commit 1676233Copy full SHA for 1676233
example/system/CMakeLists.txt
@@ -1,4 +1,5 @@
1
ADD_EXAMPLE(get_runtime_os)
2
+ADD_EXAMPLE(null_device)
3
ADD_EXAMPLE(os_type)
4
ADD_EXAMPLE(process_1)
5
ADD_EXAMPLE(process_2)
example/system/example_null_device.f90
@@ -0,0 +1,20 @@
+! Showcase usage of the null device
+program example_null_device
+ use stdlib_system, only: null_device
+ use iso_fortran_env, only: output_unit
+ implicit none
6
+ integer :: unit
7
+ logical :: screen_output = .false.
8
+
9
+ if (screen_output) then
10
+ unit = output_unit
11
+ else
12
+ ! Write to the null device if no screen output is wanted
13
+ open(newunit=unit,file=null_device())
14
+ endif
15
16
+ write(unit,*) "Hello, world!"
17
18
+ if (.not.screen_output) close(unit)
19
20
+end program example_null_device
0 commit comments