File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -11,3 +11,4 @@ ADD_EXAMPLE(process_5)
1111ADD_EXAMPLE(process_6)
1212ADD_EXAMPLE(process_7)
1313ADD_EXAMPLE(sleep)
14+ ADD_EXAMPLE(fs_error)
Original file line number Diff line number Diff line change 1+ program example_fs_error
2+ use stdlib_system, only: fs_error
3+ implicit none
4+
5+ type (fs_error) :: err, err0
6+
7+ err = fs_error(1 , ' Operation not permitted' ) ! EPERM
8+
9+ ! Print message
10+ print * , err% print ()
11+
12+ ! Check success
13+ print * , ' Check error: ' ,err% error()
14+ print * , ' Check flag : ' ,err% code /= 0
15+
16+ call err% handle(err0)
17+
18+ ! Print flag
19+ print * , err0% print ()
20+
21+ ! Check success
22+ print * , ' Check error: ' ,err0% error()
23+ print * , ' Check flag : ' ,err0% code /= 0
24+
25+ ! call err%handle() ! stops the program
26+
27+ end program example_fs_error
You can’t perform that action at this time.
0 commit comments