Creating a console window

This is a discussion on Creating a console window within the C Programming forums, part of the General Programming Boards category; Hi All, I have very little idea about GUI programming in C however I have worked both in JAVA and ...

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    23

    Creating a console window

    Hi All,

    I have very little idea about GUI programming in C however I have worked both in JAVA and C# with GUI.Now I am using mingw in Windows 7 and I want to create a CLI console window like command prompt for user interaction.Please provide some idea or some links anything goes.

    Thanks,
    Arka

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Code:
    system("cmd.exe");
    There... that was easy.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,750
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Aug 2011
    Posts
    23
    @CommonTater
    I didn't maen that.system("cmd") will open up a new command prompt window.I don't want that.I want to create my own cli like turbo c uses to console i/o.

    Thanks,
    Arka.

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Before we get into that... Turbo C ??? Really??? You're seriously using that ancient and totally outdated piece of dinosaur dung?
    You need to get yourself up to date. That's a DOS compiler that spits out 16bit code that won't even run on 64bit operating systems and for a certainty it's no big selling point in a job application, unless you've got a time machine to take you back to 1984...

    Now about this CLI thing... on any version of Windows newer than Win2000 the Command Shell is actually a windows program (cmd.exe) that is run by windows. The command I gave you will open a CLI window for you. The console window you see open when you run a program is created by your program's startup code, not Turbo C... go ahead and compile up a little program, make sure it uses getchar(); at the end to keep the console window open...exit turbo c, find your program, click on it and you'll see that it creates it's own window...

    If you're planning to write your own windows terminal (i.e. a cmd.exe replacement) you're going to need a LOT more programming skill... that's not a DOS program, it's actually a windows program using windows API calls. It's also a full blown interpreter and that's not beginner level coding.

    Now, seriously... You have got to get something newer than Turbo C ... That's just a train wreck waiting to happen.
    Try ... smorgasbordet - Pelles C
    Last edited by CommonTater; 09-08-2011 at 08:43 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SDL Window opening with Console Window
    By carrotcake1029 in forum Windows Programming
    Replies: 2
    Last Post: 12-23-2008, 03:32 PM
  2. Creating a child window in a parent window
    By vopo in forum Windows Programming
    Replies: 8
    Last Post: 10-06-2007, 05:15 PM
  3. Creating a New console?
    By rabbit in forum C++ Programming
    Replies: 1
    Last Post: 03-18-2006, 03:13 PM
  4. Problem with creating new window, from another window
    By Garfield in forum Windows Programming
    Replies: 6
    Last Post: 01-11-2004, 02:10 PM
  5. Creating Windows from Console
    By ashu12 in forum Windows Programming
    Replies: 3
    Last Post: 10-21-2002, 06:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21