PDA

View Full Version : fstream io Help


spa
2002-04-08, 05:57 PM
can some tell me wats wrong with my code it prints nothin to the screen

#include <fstream.h>
#include <conio.h>
int main()
{
ifstream in_file("Greeting.ext");
ofstream out_file("Out.ext");
int numbersOfContestant;
numbersOfContestant = 3;
out_file << "Numbers of contestant: " << numbersOfContestant << endl;
out_file << "Names of contestant:\n";
out_file << "David" << endl;
out_file << "Janice" << endl;
out_file << "GundamSD" << endl;

out_file << "Greeting, David, welcome to the contest!" << endl;
out_file << "Greeting, Janice,welcome to the contest!" << endl;
out_file << "Greeting, GundamSD, welcome to the contest!" << "\n\n";
out_file << "Press enter to exit.";
getche();
}

Badass Gandhi
2002-04-08, 08:25 PM
It doesn't print anything to the screen because all of the output goes to out_file, so all of it ends up in Out.ext