File tree Expand file tree Collapse file tree 3 files changed +20
-15
lines changed Expand file tree Collapse file tree 3 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -530,19 +530,5 @@ The file is removed from the filesystem if the operation is successful. If the o
530
530
### Example
531
531
532
532
``` fortran
533
- program example_delete_file
534
- use stdlib_fs
535
- implicit none
536
-
537
- type(state_type) :: err
538
-
539
- ! Delete a file with error handling
540
- call delete_file("example.txt", err)
541
-
542
- if (err%error()) then
543
- print *, "Failed to delete file:", err%print()
544
- else
545
- print *, "File deleted successfully."
546
- end if
547
- end program example_delete_file
533
+ {!example/system/example_delete_file.f90!}
548
534
```
Original file line number Diff line number Diff line change 1
1
ADD_EXAMPLE (get_runtime_os )
2
+ ADD_EXAMPLE (delete_file )
2
3
ADD_EXAMPLE (is_directory )
3
4
ADD_EXAMPLE (null_device )
4
5
ADD_EXAMPLE (os_type )
Original file line number Diff line number Diff line change
1
+ ! Demonstrate usage of `delete_file`
2
+ program example_delete_file
3
+ use stdlib_system, only: delete_file
4
+ use stdlib_error, only: state_type
5
+ implicit none
6
+
7
+ type (state_type) :: err
8
+ character (* ), parameter :: filename = " example.txt"
9
+
10
+ ! Delete a file with error handling
11
+ call delete_file(filename, err)
12
+
13
+ if (err% error()) then
14
+ print * , err% print ()
15
+ else
16
+ print * , " File " // filename// " deleted successfully."
17
+ end if
18
+ end program example_delete_file
You can’t perform that action at this time.
0 commit comments