Skip to content

Commit d9c655d

Browse files
committed
Add note on if file not found
1 parent d43dfc5 commit d9c655d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

documentation2/B07-File-Handling.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,10 @@ cargo run
198198
```bash
199199
Removed file data.txt
200200
```
201+
202+
Here, we import the `std::fs` module for deleting a file. We use the `remove_file()` method to delete the file `data.txt`.
203+
204+
If the operation does not proceed, we return a custom message: `could not remove file` in case of an error.
205+
206+
If the file `data.txt` is not found or cannot be removed, we encounter an error.
207+

0 commit comments

Comments
 (0)