LordFudge
0
Q:

c++ write new file

ofstream myfile;
myfile.open("file.txt");

myfile << "write this to file"
1

    #include <iostream>
#include <fstream>
using namespace std;


    int main() {
  // Create and open a text file
  ofstream MyFile("filename.txt");

  // 
    Write to the file
  MyFile << "Files can be tricky, but it is fun 
    enough!";

  // 
    Close the file
  MyFile.close();
} 
0

New to Communities?

Join the community