Skip to content

Commit e6c6a21

Browse files
committed
new examples
1 parent 1613fb5 commit e6c6a21

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

example/system/example_exists.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ program example_exists
88
type(state_type) :: err
99

1010
! Path to check
11-
character(*), parameter :: path = "path"
11+
character(*), parameter :: path = "path/to/check"
1212
! To get the type of the path
1313
integer :: t
1414

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
! Demonstrate usage of `is_regular_file`
2+
program example_is_directory
3+
use stdlib_system, only: is_regular_file
4+
implicit none
5+
6+
character(*), parameter :: path = "path/to/check"
7+
8+
! Test if path is a regular file
9+
if (is_regular_file(path)) then
10+
print *, "The specified path is a regular file."
11+
else
12+
print *, "The specified path is not a regular file."
13+
end if
14+
end program example_is_directory

example/system/example_is_symlink.f90

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
! Demonstrate usage of `is_symlink`
2+
program example_is_directory
3+
use stdlib_system, only: is_symlink, is_directory
4+
implicit none
5+
6+
character(*), parameter :: path = "path/to/check"
7+
8+
! Test if path is a symbolic link
9+
if (is_symlink(path)) then
10+
print *, "The specified path is a symlink."
11+
! Further check if it is linked to a file or a directory
12+
if (is_directory(path)) then
13+
print *, "Further, it is a link to a directory."
14+
else
15+
print *, "Further, it is a link to a file."
16+
end if
17+
else
18+
print *, "The specified path is not a symlink."
19+
end if
20+
end program example_is_directory

0 commit comments

Comments
 (0)