Skip to content
Prev Previous commit
Next Next commit
add err handling to example
  • Loading branch information
wassup05 committed Aug 23, 2025
commit d047e1fa703bd4b92cf46276d605bbb8b6e448c4
15 changes: 13 additions & 2 deletions example/system/example_get_file_size.f90
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
program example_get_file_size
use, intrinsic :: iso_fortran_env, only: int64
use stdlib_system, only: get_file_size
use stdlib_error, only: state_type
implicit none

type(state_type) :: err
integer(int64) :: size

character(*), parameter :: path = "src"
character(*), parameter :: path = "path/to/check"

size = get_file_size(path, err)

print *, get_file_size(path)
if (err%ok()) then
print *, "Size in bytes = ", size
else
print *, "Error!: ", err%print()
end if

end program example_get_file_size

Loading