system("shutdown -s -c")

closed account (DGvMDjzh)
Hi. I'm pretty much new at C++. I have a small problem with adding a string that contains text in system("shutdown -s -c"). It should be like this system("shutdown -s -c textfromthestring"). Any ideas how do this? Thanks.
You mean like:

system((std::string("shutdown -s -c")+my_other_str).c_str());
closed account (DGvMDjzh)
Doesn't work for me. Let me get this straight...

I should replace the my_other_str with the string?
If that's the case it doesn't work.


Is my_other_str an std::string or a constant Cstring (like "my stuff")?
You declare a variable (std::string) called my_other_str, and put the string you want in it.
closed account (DGvMDjzh)
Thanks. I gotten hold of the problem.
Last edited on
Topic archived. No new replies allowed.