Help me

Pages: 12
Oct 10, 2015 at 1:20pm
How can i make a function that open cmd.exe with something in it?

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

using namespace std;

int main()
{

system("Start cmd.exe");

return 0;
}
Last edited on Oct 10, 2015 at 1:22pm
Oct 10, 2015 at 1:26pm
What do you mean "with something in it"?
Oct 10, 2015 at 1:28pm
After i run it and cmd.exe is opened there i want to be already written something.
Last edited on Oct 10, 2015 at 1:31pm
Oct 10, 2015 at 1:34pm
Be more specific - do you want the user to be able to backspace whatever is written?
Oct 10, 2015 at 1:34pm
add razzvan_2000 at skype and talk there
Oct 10, 2015 at 1:47pm
Sorry, I only give help in public.
Oct 10, 2015 at 1:49pm
Wait ~20 and i explain better
Oct 10, 2015 at 2:07pm
When i run the program i want to open 2 cmds 1 from codeblocks and 1 from pc and in cmd from pc i want to be already written something like "Troll". Because i want to troll my friend and i know to make a loop but i don't know how to make to open the cmd where is written "troll".
Oct 10, 2015 at 2:22pm
Again: do you want the user to be able to backspace whatever is written?

There are multiple ways to do what you are trying to do. C++ is not one of the ways I would recommend.

The cmd.exe program has built-in support for what you want to do - try running help cmd
Last edited on Oct 10, 2015 at 2:28pm
Oct 10, 2015 at 2:25pm
I don't want the user to be able to backspace whatever is writte.
Oct 10, 2015 at 2:28pm
Maybe you just want to run cmd /K "echo message"?
Oct 10, 2015 at 2:30pm
Can you edit this to work?


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

using namespace std;

int main()
{

system("Start cmd.exe");

return 0;
}
Oct 10, 2015 at 2:31pm
Why do you want to do this in C++? There are much better and easier ways to accomplish this.
1
2
3
4
5
6
#include <cstdlib>

int main()
{
	std::system("cmd /K \"echo message\"");
}
Oct 10, 2015 at 2:39pm
Something like this and if you can make that auto-enter :D
http://iceimg.net/image/Cal
Oct 10, 2015 at 2:40pm
I literally just showed you how to do that, are you so lazy that you cannot even change 12 characters?
Oct 10, 2015 at 2:42pm
Man i changed but when i run it doesn't happened nothing or how can i make it like cout and just to press enter
Oct 10, 2015 at 2:49pm
I don't know what you mean, it works for me. Again, why do you want to do this with C++? C++ is not the correct language for this.
Oct 10, 2015 at 2:52pm
It's like you open the cmd then press enter and something is doing that's what i want to do in c++
Oct 10, 2015 at 2:53pm
I already showed you the code required to make that happen, and I tested it myself - it works. You still have not answered: why C++?
Oct 10, 2015 at 2:55pm
what shoud i use?
Pages: 12