Arguments

Hi,

I want to be able to write a program where I can record user input but combine it with command line arguments. For example I do a simple getline(); and the user types test how to combine it so it could be like test /q and it gives a different output depending on what additional input was added. Can this be done with lots of different inputs? Sorry if I haven't explained it well or this is really obvious but I'm very new to C++. All help will be really appreciated as I don't know what to do :(

Thank you for your time,

Joe
closed account (N36fSL3A)
Yea. It could be done with a long line of switch statements.

I heard there's another way, though. But for me I just use switches. Sorry I couldn't be of more help.
closed account (Dy7SLyTq)
just write it into a string and use string addition
Thanks guys, but I'm writing a long program and all that code isn't going to cut it. I need to find an efficient way, like how Microsoft did with command prompt and GNU did with Terminal. I'm not intending on writing a program of that level but they must of used a method that worked well.
closed account (N36fSL3A)
Split the string by spaces, and use switch statements. I'm sure that's how they did it.
Last edited on
closed account (Dy7SLyTq)
Split the string by spaces, and use switch statements. I'm sure that's how they did it.
no not even close. the gnu terminal and windows command prompt (can it be called command shell?) are much more complicated than that
Last edited on
closed account (N36fSL3A)
I mean if statements. Silly me. You can't use switches with strings.

What did they do then DTS?
closed account (Dy7SLyTq)
i mean of course the shell uses ifs, but its more complicated than that,
Topic archived. No new replies allowed.