Help me

Pages: 12
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
What do you mean "with something in it"?
After i run it and cmd.exe is opened there i want to be already written something.
Last edited on
Be more specific - do you want the user to be able to backspace whatever is written?
add razzvan_2000 at skype and talk there
Sorry, I only give help in public.
Wait ~20 and i explain better
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".
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
I don't want the user to be able to backspace whatever is writte.
Maybe you just want to run cmd /K "echo message"?
Can you edit this to work?


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

using namespace std;

int main()
{

system("Start cmd.exe");

return 0;
}
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\"");
}
Something like this and if you can make that auto-enter :D
http://iceimg.net/image/Cal
I literally just showed you how to do that, are you so lazy that you cannot even change 12 characters?
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
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.
It's like you open the cmd then press enter and something is doing that's what i want to do in c++
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++?
what shoud i use?
Pages: 12