Mac Osxtopus
Registered
Im sure all you bordlanders have seen this program, but i cant get it to dang work. Have a look: (no syntax errors reported, it compiles fine , but the output file is empty. including header files is fine, tthe forum just doesnt like alligators.)
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
main()
{
ifstream infile("build/before.txt");
ofstream outfile("after.txt");
int counter;
char letter;
infile.open("before.txt",ios::in); // the yawn is a : with an o
if(infile.fail())
{
cerr << "the file didn't open correctly";
abort();
}
while(infile >> counter && infile.get(letter)){
outfile.open("after.txt",ios:ut);
outfile << setw(2) << counter << letter;
}
infile.close();
outfile.close();
return 0;
}
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
main()
{
ifstream infile("build/before.txt");
ofstream outfile("after.txt");
int counter;
char letter;
infile.open("before.txt",ios::in); // the yawn is a : with an o
if(infile.fail())
{
cerr << "the file didn't open correctly";
abort();
}
while(infile >> counter && infile.get(letter)){
outfile.open("after.txt",ios:ut);
outfile << setw(2) << counter << letter;
}
infile.close();
outfile.close();
return 0;
}