Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 6th, 2006, 12:06 PM   #1
paulchwd
Hobbyist Programmer
 
paulchwd's Avatar
 
Join Date: Mar 2005
Posts: 139
Rep Power: 4 paulchwd is on a distinguished road
C IDE FOR WIDNOWS --> PLS HELP !!

Hello,

I am desperatly looking for a good c ide for widnows (not linux) . I have Visual Studio, but it is driving me nuts, and doesnt like to show output on the console unless i do a scanf .

Any help is much appreciated...ps: i kinda new to C
paulchwd is offline   Reply With Quote
Old Jun 6th, 2006, 12:19 PM   #2
coldDeath
Expert Programmer
 
coldDeath's Avatar
 
Join Date: Aug 2005
Location: UK
Posts: 862
Rep Power: 4 coldDeath is on a distinguished road
Send a message via AIM to coldDeath Send a message via Yahoo to coldDeath
Quote:
I have Visual Studio, but it is driving me nuts, and doesnt like to show output on the console unless i do a scanf .
Put std::cin.get(); before exiting main().

Also take a look at Bloodshed Dev-C++ or Code::Blocks.
__________________
Join us at #programmingforums @ irc.freenode.net!

My software never has bugs. It just develops random features.
coldDeath is offline   Reply With Quote
Old Jun 6th, 2006, 12:42 PM   #3
Narue
Professional Programmer
 
Narue's Avatar
 
Join Date: Sep 2005
Posts: 419
Rep Power: 4 Narue is on a distinguished road
>doesnt like to show output on the console unless i do a scanf
The who and the what, now? Can you describe your problem in detail for us? It doesn't sound like any common problem I'm familiar with, especially since Visual C++ doesn't have that annoying "close the window when the program ends unless you pause or ask for input" thing going on.
__________________
Even if the voices aren't real, they have some pretty good ideas.
Narue is offline   Reply With Quote
Old Jun 6th, 2006, 1:41 PM   #4
Serinth
Programmer
 
Serinth's Avatar
 
Join Date: Sep 2005
Posts: 50
Rep Power: 4 Serinth is on a distinguished road
I think what he means is that if he runs the .exe, he won't see any output unless he's prompting for input, that way the terminal will remain open and not finish so you can see what happens. If you run it in Visual studio though, it will stop and let you view what happens instead of double clicking the .exe alone. Paulchwd, if you use system("pause"); at the end, you'll be able to see your output and the console won't close until you push a button.
__________________
A girl talked to me once.

http://www.latestanime.com
Serinth is offline   Reply With Quote
Old Jun 6th, 2006, 1:48 PM   #5
Harakim
Hobbyist Programmer
 
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3 Harakim is on a distinguished road
This code is not guarenteed to show up until your program actually closes:
printf( "Hello" );

You can use:
printf( "Hello\n" );

If this is your problem, hopefully other people will comment on it. I don't actually know about the different ways to correctly flush the buffer.
Harakim is offline   Reply With Quote
Old Jun 6th, 2006, 3:00 PM   #6
paulchwd
Hobbyist Programmer
 
paulchwd's Avatar
 
Join Date: Mar 2005
Posts: 139
Rep Power: 4 paulchwd is on a distinguished road
Exclamation

Quote:
Originally Posted by Serinth
I think what he means is that if he runs the .exe, he won't see any output unless he's prompting for input, that way the terminal will remain open and not finish so you can see what happens. If you run it in Visual studio though, it will stop and let you view what happens instead of double clicking the .exe alone. Paulchwd, if you use system("pause"); at the end, you'll be able to see your output and the console won't close until you push a button.

What do i do in visual studio to see the output of my program (hello world for example)

#include <stdio.h>

int main()
{

  printf("\nHello wolrd\n");
 
  return 0;
}

if i dont do a scanf or gets() or something like that
paulchwd is offline   Reply With Quote
Old Jun 6th, 2006, 3:48 PM   #7
Prm753
Professional Programmer
 
Prm753's Avatar
 
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 4 Prm753 is on a distinguished road
Send a message via AIM to Prm753 Send a message via MSN to Prm753
#include <stdio.h>
int main()
{
    printf("Hello World!\n");
    system("pause");
    return 0;
}

That will show up if you run the .exe by itself.
__________________
The world's first athletic computer geek!
The home of PrProgramsStudios
How not to post a question: <-- Please don't reply
Prm753 is offline   Reply With Quote
Old Jun 6th, 2006, 5:17 PM   #8
bl00dninja
Programming Guru
 
bl00dninja's Avatar
 
Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5 bl00dninja is on a distinguished road
more data please, you're using possibly the best IDE ever.
__________________
i put on my robe and wizard hat...

Have you ever heard of Plato, Aristotle, Socrates?...Morons.
bl00dninja is offline   Reply With Quote
Old Jun 6th, 2006, 6:28 PM   #9
Harakim
Hobbyist Programmer
 
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3 Harakim is on a distinguished road
You're using a console project right? Does a file names stout.log or printf.log or something like that appear in your project folder?
Harakim is offline   Reply With Quote
Old Jun 6th, 2006, 6:45 PM   #10
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
When a console window is finished, it closes. If you don't want it to close, ask it to do something else first. If you don't want it to close until it gets some user input, get some user input:
printf("Press the return key to close the window.\n");
getchar();
return 0;

The getchar function gets a character from the user. Usually, we'd use it as follows:
char myCharacter;
myCharacter = getchar();
But we don't want to use the character for anything - it's just a hack to get the computer to wait around. So instead of storing it in a variable, we just leave it floating around in the ether.

If your code is definitely going to be used only in Windows, you can use the getch function instead of getchar. Whereas getchar waits till the return key is pressed before returning a character, getch will return on the first keypress. You can find it in conio.h.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:28 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC