everyone. I know there are a lot of related threads, but I can't understand them very well, so I decided to write my own.
I am trying to write a Win32 Console Application, and this is I would like to do:
Let's suppose my name app is: MyApp.exe, so I want every time I type in the command line:
MyApp.exe -W Hello
My app writes "Hello" in the output. Same as other arguments. Basically, I want to control every argument that I want but I don't know how to do that.
This is all I have:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
int main(int argc, char *argv [])
{
int count;
printf("This program was called with \"%s\". \n", argv[1]);
printf("\n");
system("Pause");
}
I mean, I know every argument is in the argv array, but I don't know how to parse that, like:
if(argv[1] == "-W")
It does not work.
Thanks a lot!