954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

miracle c problem

I've never coded in c before but have to for a class that I'm taking. I'm using miracle c as my compiler but am having a strange error when I try to execute a program. The program executes, but the command window instantly closes so I can't even tell if the program is working as it should. This seems like it should be a fairly simple problem to solve, but is really annoying!

thanks,
nick clark

neclark2
Newbie Poster
14 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

It's not an error. Windows automatically closes console applications once they're finished. To pause the program before it quits (so you can view the console output), put getchar(); at the end of your program.

John A
Vampirical Lurker
Team Colleague
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
 

write getchar(); before return. That should pause until you press enter if no characters was left behind in the stdin.
If you can change compiler. Miracle C is broken. Look here for some suggestions

Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218
 

u can also getch() but it doesnot work in some compiler.

DangerDev
Posting Pro in Training
485 posts since Jan 2008
Reputation Points: 165
Solved Threads: 59
 
u can also getch() but it doesnot work in some compiler.


Why do people insist on making bad suggestions, especially after a good suggestion has been made?

And if you read the Rules, they requestyou use the word you, not the letter u, so people that don't speak English well can understand your post.

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

Why do people insist on making bad suggestions, especially after a good suggestion has been made?

And if you read the Rules, they request you use the word you, not the letter u, so people that don't speak English well can understand your post.

thanx for suggestion

DangerDev
Posting Pro in Training
485 posts since Jan 2008
Reputation Points: 165
Solved Threads: 59
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You