skill.cpp
./skill/files/src/skill.cpp · 1.2 KB
From the archive skills.tar.gz
Download the archive « Back to the archive contents
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
#define SKILL_LIST "skill.list"
#include "code2.h"
int main()
{
void open_file(ifstream& fin);
void read_file(ifstream& fin);
ifstream fin;
open_file(fin);
read_file(fin);
fin.close();
ofstream fout ("smud.h", ios::app);
fout<<"\n";
fout.close();
ofstream fout2 ("stab.h", ios::app);
fout2<<"\n";
fout2.close();
ofstream fout3 ("stab2.h", ios::app);
fout3<<"\n";
fout3.close();
return 0;
}
void open_file(ifstream& fin)
{
fin.open(SKILL_LIST);
if(!fin)
{
cout<<"\nError \""<<SKILL_LIST<<"\" Failed to open"
<<"\nProgram will now exit.\n";
exit(0);
}
}
void read_file(ifstream& fin)
{
void use_skill(string skill);
string skill;
while( getline(fin,skill) )
{
use_skill(skill);
}
}
void use_skill(string skill)
{
ofstream slm ("smud.h", ios::app);
slm<<"\nDECLARE_DO_FUN( do_"<<skill<<" );";
slm.close();
ofstream slt ("stab.h", ios::app);
slt<<"\nif ( skill == do_"<<skill<<" ) return \"do_"<<skill<<"\";";
slt.close();
ofstream alpha;
switch(skill.at(0))
{
#include "code.h"
}
}