Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C# noobery

Name: C !LAtc3T6.0. 2009-09-11 10:51

How do I execute console commands from C#?

I'm starting out with C#, moving over from C++. I'm only writing console apps for the moment.

In C++ I can write

system("pause");
system("cls");
system("color 0a");

And so on to execute things in a console. How do I do the same in C#? My googling has returned stuff that's above this level I think.

Name: Anonymous 2009-09-11 11:06

>>1
You can do the same in C#, but that's both wrong in C# and SEPPLES under Win32. What you're doing by system is to invoke the command shell with specific arguments. That's inefficient and backwards, yet it seems to be what most newbies do. You should look up the console-related APIs and do everything within your process without having to call external processes to do trivial things such as clear the screen or change a color.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List