Hey everyone, I have a quick (and hopefully simple question). I'm writing a simple program that will ask the user for two different inputs(IP address and message), save those as strings, then run a command in command prompt adding those strings on the end as arguments. I'm using it to change the message displayed on HP printer screens by using a little program called HPhack. In command prompt, it would look like this:

HPHack.exe 192.168.10.1 "Message!!"

I'm using system("command") right now, but I don't know how to pass those arguments along with it.


Thanks!

cout<<"Enter IP address of target printer:"<<endl;
    getline (cin, ip);
    
    cout<<"Enter message in quotes:"<<endl;
    getline (cin, message);
    
    system("hphack.exe "ip" "message);

Hmmm.... I don't know if I should respond to this. Something smells fishy here.

Edited 6 Years Ago by Fbody: n/a

Don't worry, I'm not using it maliciously. Me and my boss want to use it to mess with someone a little. I can do it without this code, but I'm also learning C++ and really do want to know how to do this, regardless of this specific instance.

I thought about being more general because I knew someone would respond like this, but I thought I'd be open to begin with!

Thank you! I really won't misuse it. I know this will come in handy sometime in the future though.

Thanks again!

This question has already been answered. Start a new discussion instead.