View Single Post
Old 03-13-2003, 08:49 AM   #2 (permalink)
Travis Dane
Code Monkey
 
Travis Dane's Avatar
 
Join Date: Feb 2003
Location: Netherlands
Posts: 89
Travis Dane is on a distinguished road
Send a message via ICQ to Travis Dane
Use "int main(void)" not "void main()",

#1: Do you mean when the program is executed from within
the VC IDE? It works fine here.

#2: You can use "getch();" from the <conio.h> header.

Code:
#include <string>
#include <iostream>
#include <fstream>
#include <conio.h>

using namespace std;

int main(void) // Use int main! Not void, Reason is the OS needs a return result from the program
{
	ifstream in("FillString.cpp");
	string s, line;
	while(getline(in, line))
	s += line + "\n";
	cout << s;

	getch(); // A cleaner method to hold to program until a key is pressed
	return 0;
}
__________________
OpenGL, DirectX
Travis Dane is offline   Reply With Quote