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

Pages: 1-

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: No Exceptions 2009-09-11 10:53

I thought the whole point of all this .NET faggotry was that you could call code in one language from another without any problems.

Name: Anonymous 2009-09-11 11:02

>>2
No that's the point of CLR. The point of .Net is to provide a framework of APIs that will cover any modern application. It's intended to attract people to Windows and keep them there.

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.

Name: Anonymous 2009-09-11 14:24

>>1
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx


>>4
You obviously never worked in a situation where things just need to get done, no matter how dirty. Sometimes using an existing tool is simply more effective than starting to write up something from scratch.

Name: Anonymous 2009-09-11 16:13

>>2
Only other CLI-based languages (such as VISUAL BASIC 2008 EXPRESS EDITION: REDUCING COGNITIVE LOAD ON PROGRAMMERS and Sepples/CLI), and even then, they can only work with each other through a lowest-common denominator subset of the languages (which is more or less equal to C#). For example, the CLI doesn't support F# or Haskell's parametric polymorphism or higher-kinded types, so you obviously can't use that stuff directly from C#.

Name: Anonymous 2011-03-30 22:53

You can always use the Console "object".

Name: Anonymous 2011-03-30 23:05

Here's an idea, OP.  Stop using shitty languages.

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