If you are like me and post your code on your blog youmust have noticed that the things you insert within '<' and '>' gets lost. if you want to get it the '<' and '>' correctly you'd have to use 'ANDlt;' and 'ANDgt;' , replacing your code with these things can be messy, so I created a program to convert the code into a html friendly one.
First compile the corrector.cpp file using g++ : g++ corrector.cpp -o corrector
Then run the program: ./corrector -filename -spaces
The -filename is the name of the file you want to make html friendly :P
and -spaces is either '1' to change the white spaces ' ' into ' ' or 0r '0' to just leave it.
The output file is out.cpp
Here's my code for corrector before conversion
#include
#include
#include
#include
using namespace std;
string line;
list
bool spaces;
string outfile;
string infile;
ofstream fout ("out.cpp");
int main(){
cin >> infile >> spaces;
char path[infile.size()];
for(int i= 0; i < i =" 0;">'){
corrected.push_back(">");
}
if(spaces){
if(line[i] == ' '){
corrected.push_back(" ");
}
}
if(line[i] != '<' && line[i] != '>' && ( !spaces || line[i] != ' ')){
string dumb = " ";
dumb[0] = line[i];
corrected.push_back(dumb);
}
}
while(!corrected.empty()){
fout <<>
And after the conversion
#include <fstream>
#include <iostream>
#include <string>
#include <list>
using namespace std;
string line;
list<string> corrected;
bool spaces;
string outfile;
string infile;
ofstream fout ("out.cpp");
int main(){
cin >> infile >> spaces;
char path[infile.size()];
for(int i= 0; i < infile.size(); i++){
path[i] = infile[i];
}
path[infile.size()] = '\0';
ifstream fin (path);
while(!fin.eof()){
for(int i = 0; i < line.size(); i++){
if(line[i] == '<'){
corrected.push_back("<");
}
if(line[i] == '>'){
corrected.push_back(">");
}
if(spaces){
if(line[i] == ' '){
corrected.push_back(" ");
}
}
if(line[i] != '<' && line[i] != '>' && ( !spaces || line[i] != ' ')){
string dumb = " ";
dumb[0] = line[i];
corrected.push_back(dumb);
}
}
while(!corrected.empty()){
fout << corrected.front();
corrected.pop_front();
}
fout << endl;
getline(fin, line);
}
fout.close();
}
If you are interested here's the out.cpp file for my above program. If anyone of you have any ideas please let me know :)

