We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c9bdd4b commit 6c69066Copy full SHA for 6c69066
documentation2/B07-File-Handling.md
@@ -265,3 +265,11 @@ cargo run
265
```bash
266
Appended content to a file
267
```
268
+
269
+Here, we import the `std::fs::OpenOptions` and `std::io::Write` modules for appending to a file.
270
271
+The `OpenOptions::new()` and the `append(true)` method opens the file `data.txt` for appending.
272
273
+Next, we use the `write()` method from the `File` object to write additional content `"I am learning Rust!"` to the file.
274
275
+To deal with the errors, we chain the `expect()` method with a custom error message.
0 commit comments