• HEXUS
  • HEXUS.tv
  • channel
  • gaming
  • lifestyle
  • trust
  • community
  • ESReality
  • HEXUS.community discussion forumsVisit Corsair.com

    Welcome to the HEXUS.community discussion forums forums.

    You are currently viewing our boards as a guest which gives you limited access to view most discussions and other features. By joining our free community you will have access to post topics, respond to polls and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

    Go Back   HEXUS.community discussion forums > HEXUS.help - buying advice & technical queries > Networking and Broadband

    Networking and Broadband ADSL, cable, internet and network advice and chat Add RSS Feed

    Reply
     
    LinkBack Thread Tools
    Old 27-06-2006, 02:15 PM   #1 (permalink)
    Weee, I gots an avatar
     
    UKMuFFiN's Avatar
     
    Join Date: Oct 2005
    Location: South Wales
    Posts: 934
    Thanks: 0
    Thanked 0 Times in 0 Posts
    keeping the console window open to see your program

    Sorry for the title, was hard to explain my question in a title. Its prob not even the right forum to put it in :S

    Im learnign c++, and when you start you make simple programs that run in a console window, but when you run the program if its something simple like for example, the "Hello World!" you don't see it because obviously the computer does it so fast when it gets to the program it closes. You can obviously put another std::cin at the end so the program needs something entered before it ends but none of the tutorials have this and they never say anything about the console closing. So is there a setting or somthing for command promt i can change for it to stay open after a program is run?

    Cheers.
    UKMuFFiN is offline   Reply With Quote
    Old 27-06-2006, 02:21 PM   #2 (permalink)
    The King of Vague
     
    Steve B's Avatar
     
    Join Date: Oct 2005
    Location: Glasgow
    Posts: 4,855
    Thanks: 109
    Thanked 61 Times in 57 Posts
    put getch() at the end just before return 0; that should do it

    Steve B is offline   Reply With Quote
    Old 27-06-2006, 02:24 PM   #3 (permalink)
    Weee, I gots an avatar
     
    UKMuFFiN's Avatar
     
    Join Date: Oct 2005
    Location: South Wales
    Posts: 934
    Thanks: 0
    Thanked 0 Times in 0 Posts
    Cheers Lol, i just noticed this is in the connectivity - broadband & networking forum :S.

    I thought i put it in the binarys one. Ooops.
    UKMuFFiN is offline   Reply With Quote
    Old 28-06-2006, 02:23 PM   #4 (permalink)
    Senior Member
     
    skuzgib's Avatar
     
    Join Date: Oct 2004
    Location: Bromsgrove, Worcestershire
    Posts: 1,916
    Thanks: 4
    Thanked 1 Time in 1 Post
    You could also add

    system("PAUSE");

    skuzgib is offline   Reply With Quote
    Old 28-06-2006, 02:30 PM   #5 (permalink)
    Gentoo Ricer
     
    Join Date: Jan 2005
    Location: /var/portage
    Posts: 4,259
    Thanks: 19
    Thanked 107 Times in 102 Posts
    aidanjt's system
    Code:
    char quit;
    while (quit != 'q') {
        quit << cin;
    }
    return 0;
    that's why i usually do, or something to that effect to control returning main, i prefer that as it's proper standard, and adjustable to suit interactive programs.

    Main Rig -> J&W RS780UVD-AM2+ | AMD X4 9750 | 4x2GB GieL PC2-6400 | 2x500GB (md-raid0) | Sapphire HD4870 | Gentoo (AMD64)
    Server Box -> Asus P5B-E Plus | C2D E6320 | 2x1GB OCZ PC2-8500 | 4x500GB (md-raid5) | BFG 8800GTS 320Mb | Gentoo (Hardened/AMD64)
    Test Box -> P4E 3.2Ghz Rev. E0 | Asus P4C800-E Deluxe | 2x1GB PC3200 | 1x500Gb | NVidia TNT 2 | Gentoo (X86)

    Currently breaking: eINIT
    aidanjt is offline   Reply With Quote
    Old 28-06-2006, 05:29 PM   #6 (permalink)
    Weee, I gots an avatar
     
    UKMuFFiN's Avatar
     
    Join Date: Oct 2005
    Location: South Wales
    Posts: 934
    Thanks: 0
    Thanked 0 Times in 0 Posts
    So why don't books/tutorials, esp ones that know your running your first progs in cmd tell you that it will close before you even see it run?

    std::cout << "ta for all the help.";
    UKMuFFiN is offline   Reply With Quote
    Old 28-06-2006, 11:26 PM   #7 (permalink)
    Gentoo Ricer
     
    Join Date: Jan 2005
    Location: /var/portage
    Posts: 4,259
    Thanks: 19
    Thanked 107 Times in 102 Posts
    aidanjt's system
    Technically it doesn't, ANSI/ISO C++ expects you to have a terminal open already, i.e. start->run, type "cmd" enter, and run it there. Windows (and other DEs) close the terminal windows after main() returns, if it opened the terminal, whether the return value be a zero or non-zero value. So it's pretty much a Windows cravet with commandline software.

    And most welcome

    Main Rig -> J&W RS780UVD-AM2+ | AMD X4 9750 | 4x2GB GieL PC2-6400 | 2x500GB (md-raid0) | Sapphire HD4870 | Gentoo (AMD64)
    Server Box -> Asus P5B-E Plus | C2D E6320 | 2x1GB OCZ PC2-8500 | 4x500GB (md-raid5) | BFG 8800GTS 320Mb | Gentoo (Hardened/AMD64)
    Test Box -> P4E 3.2Ghz Rev. E0 | Asus P4C800-E Deluxe | 2x1GB PC3200 | 1x500Gb | NVidia TNT 2 | Gentoo (X86)

    Currently breaking: eINIT

    Last edited by aidanjt; 28-06-2006 at 11:40 PM..
    aidanjt is offline   Reply With Quote
    Reply

    Breadcrumb
    Go Back   HEXUS.community discussion forums > HEXUS.help - buying advice & technical queries > Networking and Broadband


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Trackbacks are On
    Pingbacks are On
    Refbacks are On
    Forum Jump

    Similar Threads
    Thread Thread Starter Forum Replies Last Post
    How do I restore "Show Desktop" icon in the Quick Launch bar of Windows? davidstone28 Help - technical & advisory 7 09-01-2006 12:02 PM
    Window Tints - New Legislation Planned Barakka HEXUS.automotive - Cars & Bikes 14 05-05-2005 02:32 PM
    Recovery console "access denied" Help iranu Operating systems & applications 0 20-01-2005 11:25 AM
    Open Source Articles r1zeek General discussion 6 13-08-2004 08:14 AM



    All times are GMT. The time now is 05:47 PM.

    Any representations/statements made on the HEXUS.community discussion forums are the representations/statements of the author i.e. the person/organisation making them. If any such representations/statements are disputed they are a matter between the parties concerned. HEXUS Limited accepts no responsibility for any misrepresentations, inaccurate or false statements made by any person/organisation other than HEXUS Limited employees.
    Powered by vBulletin® Version 3.7.4
    Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
    Content Relevant URLs by vBSEO 3.2.0
    © Copyright 2008 HEXUS® Limited. All rights reserved. Unauthorised reproduction strictly prohibited.