Blang/src/mkg1m/main.cpp

53 lines
1.1 KiB
C++

#include <iostream>
#include <string.h>
#include <vector>
#include <fstream>
#include <sstream>
#include "header.h"
using namespace std;
string compile_file(string a){
return a;
}
vector<string> compile_files(vector<string> files){
vector<string> compiled_files;
for(unsigned int i=0;i<files.size(); i++){
ifstream files_content(files[i].c_str());
if(files_content){
stringstream a;
a << files_content.rdbuf();
compiled_files.push_back(a.str());
}else{
cout << files[i]+":No such file or directory" << endl;
}
}
return compiled_files;
}
int main(int argc,char *argv[])
{
bool o_engaged = false;
string output_file="";
vector<string> input_files;
for(int i=1;i<argc;i++){
if(o_engaged){
output_file = argv[i];
o_engaged=false;
continue;
}
if(strcmp(argv[i],"-o")==0){
o_engaged=true;
continue;
}
input_files.push_back(argv[i]);
}
vector<string> n = compile_files(input_files);
string k = header(n[0].size());
return 0;
}