Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 03-27-2003, 07:16 PM   #1 (permalink)
UnderWing
Registered User
 
Join Date: Mar 2003
Posts: 2
UnderWing is on a distinguished road
This is a windows/C problem

I'm more or less new to C. I have "Miracle C", and am running Windows XP. My problem is that hwenever I run my programs, the output appears in a DOS window, and once it's done running, it automatically closes. I have tried going to the properties for the command prompt, and made sure that the "exit after done" or whatever box is unchecked, yet still I have this problem. Does anyone have a solution, or a **free** compiler that they would recommend that does not output into a DOS window? Much appreciated.
UnderWing is offline   Reply With Quote
Old 03-27-2003, 07:38 PM   #2 (permalink)
abc123
bloomberg
 
abc123's Avatar
 
Join Date: Jun 2002
Location: bloomberg
Posts: 263
abc123 is on a distinguished road
Send a message via AIM to abc123 Send a message via Yahoo to abc123
heh...

it outputs to a window because thats what your program is sposed to do..


to make the window stay open do:

Code:
#include <cstdlib>

int main(){
 //...
//..

 system("pause"); // note this
 return 0;
}
fyi, a good c/c++ dev system on windows is "bloodshed" www.bloodshed.net if i remember correctly...
__________________
-- bloomberg.
abc123 is offline   Reply With Quote
Old 03-27-2003, 08:17 PM   #3 (permalink)
doccm9
Registered User
 
Join Date: Mar 2003
Posts: 3
doccm9 is on a distinguished road
Send a message via AIM to doccm9
Or you can just add the getch() command at the end, so that the window doesn't close until the program gets it's final input.
doccm9 is offline   Reply With Quote
Old 03-27-2003, 08:33 PM   #4 (permalink)
alpha
Regular Contributor
 
Join Date: Feb 2003
Posts: 120
alpha is on a distinguished road
Send a message via AIM to alpha
if you add getch(), you need to #include <conio.h>

but if you want to stay standard, use std::cin.get(); this is for c++ however. so getch() and system calls will be okay, i think. but for c, it'll be
Code:
#include <stdlib.h>
for c++, it'll be cstdlib, like abc123 posted.

it outputs in a MS-DOS window because it is a console application. graphics/windows apps are not standard c/c++. if you are new to c, you need to learn programming concepts first before thinking about win32api.

the DOS window is compiler independent, project dependent.

as for other compilers, I haven't used Miracle C, but it might be okay. I use mingw 3.2 mostly, which can be found at www.mingw.org , and sometimes Borland Bcc55, www.borland.com . These are two commonly used compilers, borland and gcc/g++.

As for Dev-c++, it uses the mingw compiler. It's a pretty good IDE, many people use it. I'm waiting for v5 to be final, though.

Best of luck! and enjoy programming.

Also, welcome to codenewbie!
alpha is offline   Reply With Quote
Old 03-28-2003, 02:00 AM   #5 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Valmont is offline   Reply With Quote
Old 03-28-2003, 02:01 AM   #6 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
I'd also like to second Alpha. Borland or gcc.
Valmont is offline   Reply With Quote
Old 03-28-2003, 07:17 AM   #7 (permalink)
doccm9
Registered User
 
Join Date: Mar 2003
Posts: 3
doccm9 is on a distinguished road
Send a message via AIM to doccm9
Oops, my bad. I was half asleep when I posted my reply and left out some details.
doccm9 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
c simple question problem with switch case if13121 Standard C, C++ 1 10-24-2004 10:43 PM
problem with editing profile cheawick Feedback 0 04-28-2004 11:26 PM
JavaScript Problem dawkim HTML, XML, Javascript, AJAX 2 01-26-2004 08:02 PM
Help debugging a power problem Belisarius Lounge 0 10-25-2003 05:44 PM
structure problem Goshi Standard C, C++ 5 04-21-2003 01:19 AM


All times are GMT -8. The time now is 11:49 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting