Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C (http://www.programmingforums.org/forum60.html)
-   -   C IDE FOR WIDNOWS --> PLS HELP !! (http://www.programmingforums.org/showthread.php?t=10197)

paulchwd Jun 6th, 2006 1:06 PM

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

coldDeath Jun 6th, 2006 1:19 PM

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.

Narue Jun 6th, 2006 1:42 PM

>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.

Serinth Jun 6th, 2006 2:41 PM

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.

Harakim Jun 6th, 2006 2:48 PM

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.

paulchwd Jun 6th, 2006 4:00 PM

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

Prm753 Jun 6th, 2006 4:48 PM

:

#include <stdio.h>
int main()
{
    printf("Hello World!\n");
    system("pause");
    return 0;
}


That will show up if you run the .exe by itself.

bl00dninja Jun 6th, 2006 6:17 PM

more data please, you're using possibly the best IDE ever.

Harakim Jun 6th, 2006 7:28 PM

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?

Ooble Jun 6th, 2006 7:45 PM

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.


All times are GMT -5. The time now is 7:59 AM.

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