file operations

I can open text file but How i open new folder in c++?

1
2
3
4
5
6
7
8
9
10
11
12
// basic file operations
#include <iostream>
#include <fstream>
using namespace std;

int main () {
  ofstream myfile;
  myfile.open ("example.txt");
  myfile << "Writing this to a file.\n";
  myfile.close();
  return 0;
}


Last edited on
 
myfile.open ("new folder/example.txt");


Just a note the folder needs to be there as c++ wont create it for you like it does for the text file. unless you create the directory in code.
thanks a lot
Topic archived. No new replies allowed.