I really cannot figure out what is wrong here... I want the code to create a file when I type one argument in the terminal. It works fine if argc is set to 1, but not anything above that. Any help is much appreciated ! Cheers & a nice sunday
#include <fstream>
#include <string>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
if (argc==(2))
{
ofstream file("MyFile.txt"); // Creates MyFile.txt
}
else
{
cout << "type one argument !" << endl;
}
return 0;
}