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)