Why doesnt my prgrm read in parameters properly?

Im trying to create a program for a C++ project where you need to read in a parameter from the command line with your program, and then do some functions with the parameter.
so i tried creating this program and popping the parameter into a string, but every time i try running it, it crashes
btw im trying to cout the parameter so i can see that it reads in properly

code:
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(char * argv []) {

string folder = argv[0];

cout << folder;
}
You forgot the number of parameters.

1
2
3
int main(int argc, char *argv[])
{
}


Be advised, the first parameter, argv[0] is usually the program's name.
This means that if you pass say three parameters, argc will equal 4.
Topic archived. No new replies allowed.