first program evaluation
From: Pieter Provoost (pieterprovoost_at_tiscali.be)
Date: 05/31/04
- Next message: Daniel T.: "Re: SImple question about structure and linked list"
- Previous message: Pete Becker: "Re: function template"
- Next in thread: Phlip: "Re: first program evaluation"
- Reply: Phlip: "Re: first program evaluation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 31 May 2004 19:39:06 +0200
Hi,
I just made my first c++ program, and I would like to know if there are
things I can do better. Also, the exe is about 500 kb, can I make it
smaller?
Thanks!
Pieter
#include <string>
#include <fstream>
using namespace std;
int main()
{
string buffer;
string includebuffer;
string bestand;
string configin;
string configout;
ifstream config("config.txt");
getline(config, configin);
getline(config, configout);
config.close();
ifstream infile(configin.c_str());
ofstream outfile(configout.c_str());
while (getline(infile, buffer))
{
if (buffer == "")
{
outfile << " " << endl;
}
else
{
if (buffer.substr(1,7) == "include")
{
bestand = buffer.substr(9, (buffer.find_first_of("}") - 9));
bestand += ".tex";
ifstream includefile(bestand.c_str());
while (getline(includefile, includebuffer))
{
outfile << includebuffer << endl;
}
includefile.close();
}
else
{
outfile << buffer << endl;
}
}
}
infile.close();
outfile.close();
return 0;
}
- Next message: Daniel T.: "Re: SImple question about structure and linked list"
- Previous message: Pete Becker: "Re: function template"
- Next in thread: Phlip: "Re: first program evaluation"
- Reply: Phlip: "Re: first program evaluation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|