cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
system("shutdown -s -c")
system("shutdown -s -c")
Jun 17, 2010 at 7:14pm UTC
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.
Jun 17, 2010 at 7:19pm UTC
firedraco
(6243)
You mean like:
system((std::string(
"shutdown -s -c"
)+my_other_str).c_str());
Jun 17, 2010 at 7:34pm UTC
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.
Jun 17, 2010 at 8:08pm UTC
firedraco
(6243)
Is my_other_str an std::string or a constant Cstring (like "my stuff")?
Jun 18, 2010 at 2:50am UTC
QWERTYman
(461)
You declare a variable (std::string) called my_other_str, and put the string you want in it.
Jun 18, 2010 at 8:38am UTC
closed account (
DGvMDjzh
)
Thanks. I gotten hold of the problem.
Last edited on
Jun 18, 2010 at 8:51am UTC
Topic archived. No new replies allowed.