From 33d73be9cf809d23b4111143dc769082fcd5ac18 Mon Sep 17 00:00:00 2001 From: silentboy-warrior Date: Sat, 7 Dec 2024 18:58:50 -0800 Subject: [PATCH] Typo error --- README.md | 2 +- cheatsheet-as-sourcefile.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 481ab84..c2688a2 100644 --- a/README.md +++ b/README.md @@ -390,7 +390,7 @@ if (f1) // Test if open and input available f1 >> x; // Read object from file f1.get(s); // Read char or line f1.getline(s, n); // Read line into string s[n] -ofstream f2("filename"); // Open file for writing +ifstream f2("filename"); // Open file for writing if (f2) f2 << x; // Write to file ``` diff --git a/cheatsheet-as-sourcefile.cpp b/cheatsheet-as-sourcefile.cpp index 0d3dedd..9ebf2f4 100644 --- a/cheatsheet-as-sourcefile.cpp +++ b/cheatsheet-as-sourcefile.cpp @@ -366,7 +366,7 @@ if (f1) // Test if open and input available f1 >> x; // Read object from file f1.get(s); // Read char or line f1.getline(s, n); // Read line into string s[n] -ofstream f2("filename"); // Open file for writing +ifstream f2("filename"); // Open file for writing if (f2) f2 << x; // Write to file // ## `string` (Variable sized character array)