|
||||||
| C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Alrighty, I borrowed a C programming book from my cousin to help me get into programming, and I downloaded a bloodshed compiler.
Ok, I typed out this simple function: #include <stdio.h> main () { printf("hello, world/n"); } compile it, save it as a C source file on desktop. I click on the desktop icon I just created to get my output, but the window with the output only pops up for like a millisecond! I need to it stay up, so I can move on the more advanced things where I might actually want to LOOK at my output. Make sense? I know, I'm completely new to this. I hope you can help me. |
| Sponsored Links |
|
|
|
|||
|
try this:
-open a command prompt. -drag the desktop icon into it. -hit 'enter'. -The program will work It's doing exactly what you want. It's printing "hello, world", then exiting. Here's a bit of a picture guide of what I described. I used a perl file to do this, btw. ![]() ![]() ![]()
__________________
Programming is an art form. Everyone can program, but few can do it right. Last edited by suicidal pencil; 05-15-2008 at 04:24 PM. |
|
|||||
|
A common way is also to "pause" the program right in the end. It can be done in various ways. You can choose to you use the system-command, pause, in Windows, which will do the job for you, or you can wait for user-input in the end.
system("pause"); or getchar(); These functions shall be thrown in right before the end of the main-function. Note that the first solution using the pause-command only will work on platforms having the pause-command.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum C/C++ resources - C/C++ frequently asked questions Python resources - Python frequently asked questions I'm always up for a chat, so feel free to contact me... |
|
|||
|
__________________
Programming is an art form. Everyone can program, but few can do it right. |
| Sponsored Links |
|
|
|
|||
|
Or you can read something to a variable:
Code:
char a;
printf("%c",&a);
But it all depends on your platform (OS). |
|
|||||
|
You could try a loop, which is very common in command-line applications.
|
|
|||||
|
Personally, I'd never use any of these solutions, except the one provided by suicidal pencil. I prefer to run, and also compile the program, directly from the terminal.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum C/C++ resources - C/C++ frequently asked questions Python resources - Python frequently asked questions I'm always up for a chat, so feel free to contact me... |
|
|||||
|
Code:
#include <stdio.h>
#include <iostream>
using namespace std;
main ()
{
printf("hello, world/n");
cin.get();
}
__________________
Success is the ability to go from failure to failure without losing your enthusiasm. ~ Winston Churchill Braingle |
|
|||
|
Quote:
![]() |
| Sponsored Links |
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Total Newbie to C# - Hope ye can help! | grungefreak1 | Introductions | 3 | 11-26-2007 07:21 AM |
| 2D Array newb | The Midnighter | Java Help | 3 | 11-06-2007 09:56 PM |
| I am a total Newb... | BadMrPat | General Programming | 5 | 05-01-2007 12:06 PM |
| Help a Newb Learn it.. | Mushroomer | Visual Basic Programming | 1 | 03-28-2007 05:30 PM |
| total members visited today | Void | The Lounge | 3 | 07-15-2006 12:25 PM |
| Xav | ........ | 1357.94 |
| MeTh0Dz|Reb0rn | ........ | 1083.85 |
| WingedPanther | ........ | 919.18 |
| marwex89 | ........ | 906.86 |
| morefood2001 | ........ | 903.18 |
| John | ........ | 902.37 |
| Brandon W | ........ | 789.89 |
| chili5 | ........ | 312.39 |
| Steve.L | ........ | 264.99 |
| dcs | ........ | 240.34 |
Goal: 100,000 Posts
Complete: 83%