[Help]help.exe -h?

Posts 1–4 of 4 · Page 1 of 1
[Help]help.exe -h?
So basically I want to make a program that uses the -h -l -s and so on things (not to sure what their called, which makes it difficult to google)

E.G.
Code:
C:\WINDOWS\>example -h
I've seen a open-source program that does it and I've tried to extract what it uses into my program but it never seems to work. (compiled perfectly fine but crashed when I try to use the arguments)
(it used the arguments in main() to "scan" for the letters)

I thought I would ask you guys for a lil but of help.
Use a switch()
~
They are called parameters. Heres an example:

Code:
#include <windows.h>
#include <iostream>

using namespace std;

int main(int argc,char *argv[], char *envp[]){ //number of command line arguments , command line strings

for(int i=0;i<argc;i++)cout<<argv[i]<<endl;



}
If you type in "example -asd -dvdsv -asdsa 1231" in command line the program will output
Code:
(folder path)\example.exe
-asd
-dvdsv
-asdsa
1231
In your main function you have argc and argv. argc is the number of arguments in argv and argv contains these strings. The first string in argv is the file path and the rest are parameters.
Posts 1–4 of 4 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us