Thread: system("pause") in C#? (warning: noob question)

  1. #16
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    You are a free man. I can't remember anyone forcing you to use message boards.

    Some of us find them usefull others like you obviously don't.

    I like my coffee with milk and sugar, others don't.
    Which does not imply I am superior just because I drink it that way.

  2. #17
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Quote Originally Posted by dxfoo
    Every professional program goes outside of the CLS to get tasks done such as Win32 and their own specific dll's. It makes me assume that you're new to development and had no reason to go outside of the sandbox to get tasks done.
    I'm sorry, maybe that really reads, "Every professional program that you've worked on"? I have no reason to go outside of the 'sandbox', as you put it, for two reasons: the CLR standard defines enough interesting functionality to not require it often, and it's in the design specification. Believe it or not, the overwhelming majority of my company's code is CLS compliant. You may assume whatever makes you feel good about yourself; it doesn't change the reality of the situation.
    Quote Originally Posted by dxfoo
    At work we don't talk about what the best way is to pause windows
    Congratulations. You and your co-workers have advanced beyond that point; hopefully more than one of them takes the sensible way out instead of PInvoking needlessly.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  3. #18
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Who gives a rip if system("") is meant to target Windows and the system of
    >which various system-specific commands reside in.
    Just because you don't care doesn't mean that others don't. It's assumptions like this that produce crappy code.

    >Every professional program goes outside of the CLS to get tasks done such as Win32 and their own specific dll's.
    Really. Well, you're wrong because I can name at least one professional program (that I worked on recently) which uses CLS exclusively.

    >It makes me assume that you're new to development and had no reason to go outside of the sandbox to get tasks done.
    Pot. Kettle. Black.

    >Please, argue about something that's more interesting than what's the best way of calling "pause" on a console window.
    It's not the details, it's the principle. If you suggested an exceptionally poor way of loading employee records from a database via ODBC in a professional payroll system, the discussion would have followed a similar path.

    >I looked and found 90% of them very basic questions and not even worth replying to.
    >None of them are worth my time!
    I can't respond to this in a way that wouldn't break forum rules. You're welcome to leave and never return if this is how you see our community.

    >90% of them are so misinformed or basic
    Look at your own posts before complaining about the posts of others, please.

    >At work we don't talk about what the best way is to pause windows
    If you can imagine, I talk about slightly more important things at work as well. Work related topics. Probably topics well beyond your current experience level. Why? Because the people I work with already know the basics and don't need to debate it.
    My best code is written with the delete key.

  4. #19
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    If dxfoo is not satisfied with these simple questions, why not asking him some harder questions?
    dxfoo, can you please tell me your knowledge area? You are only exprienced in C# or you are experienced in x86 assembly too?
    If you are bored I will ask some hard question to put you in trouble with them.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  5. #20
    Registered User
    Join Date
    Mar 2008
    Posts
    1

    Wink This is a good answer,isnt it?

    If there is no alternative in C#,we can use System("pause") provided in msvcrt.dll,maybe it is not the best or the easiest way to do that,but we can learn from it,as we will know if we want to use those system calls in a C/C++ program,we can import msvcrt.dll
    I am also a beginner at C#,and I reached here with google when I searched answers to my question,I think dxfoo is helpful to us,isnt he?

    Quote Originally Posted by dxfoo View Post
    You can interop it with msvcrt.dll, I believe. Ah, here's my old reply to the question:

    You have to pinvoke this C function into your C# application. Luckily, this process is very easy. There are a few steps:

    1) Insert System.Runtime.InteropServices to your using clauses.
    2) Insert this line in your class (usually in the first few lines)

    [DllImport("msvcrt.dll")]
    static extern bool system(string str);

    3) In that same class, simply write this:
    system("pause");

    Hope that helps! It's not the best solution in C# to go about the problem, but hey, it's a solution.

  6. #21
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    myusername, kindly do not resurrect old threads unless you have a very good reason.

    *thread closed*
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another noob question
    By clb2003 in forum C Programming
    Replies: 4
    Last Post: 02-12-2009, 01:28 PM
  2. Noob printf question
    By lolguy in forum C Programming
    Replies: 3
    Last Post: 12-14-2008, 08:08 PM
  3. Quick Warning Question
    By Paul22000 in forum C Programming
    Replies: 1
    Last Post: 05-02-2008, 05:20 PM
  4. Real Noob question
    By Dark Greek in forum C++ Programming
    Replies: 8
    Last Post: 09-09-2007, 06:49 PM
  5. super noob question
    By verbity in forum C++ Programming
    Replies: 6
    Last Post: 06-23-2007, 11:38 AM