Write entire file: Difference between revisions
Content added Content deleted
No edit summary |
(Added C++) |
||
Line 91: | Line 91: | ||
</lang> |
</lang> |
||
=={{header|C++}}== |
|||
<lang cpp>#include <fstream> |
|||
using namespace std; |
|||
int main() |
|||
{ |
|||
ofstream file("new.txt"); |
|||
file << "this is a string"; |
|||
file.close(); |
|||
return 0; |
|||
}</lang> |
|||
=={{header|C#}}== |
=={{header|C#}}== |
||
<lang csharp>System.IO.File.WriteAllText("filename.txt", "This file contains a string.");</lang> |
<lang csharp>System.IO.File.WriteAllText("filename.txt", "This file contains a string.");</lang> |