So I want to use argv to get command line arguments. However these arguments should be able to be in any order with the flags.
so if my command line was
./a.out -t textfile.txt -m mapfile.txt
I want to find where in argv mapfile.txt would be. I can rearrange it so it can be in position 2 or 4.
I tried doing a for loop like:
int pos;
for(int i = 0; i <argc; i++){
if (argv[i] == "-t"){ //tried doing "t" as well
pos = i;
}
}
This didnt work.