Skip to content

Instantly share code, notes, and snippets.

@maemre
Created May 11, 2014 15:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maemre/63a944ea86905d2333c4 to your computer and use it in GitHub Desktop.
Save maemre/63a944ea86905d2333c4 to your computer and use it in GitHub Desktop.
create an empty file in c++ using streams
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[]) {
if (argc != 2) {
cout << "Usage: " << argv[0] << " FILE_NAME";
exit(EXIT_FAILURE);
}
fstream fs;
fs.open(argv[1], ios::out);
fs.close();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment