Thursday, April 23, 2009

Posting Code

This blog is about computers, programming and alike. So its essential for me to be able to post source code in descent form. In the case of Visual Studio the answer appeared obvious. My idea was to copy code to Windows clipboard, paste into wordpad, save as Rich Text Format file (*.rtf), convert to html and paste into blog editor.

The step that almost failed was converting from rtf to html. All free converters I was able to spot on the Web miserably failed. I even don't want to give links to the suckers. Well, I said almost. One converter worked good for me. The online one. Of course, its a hassle to use online stuff with all verifications etc., but for me its better than inferior quality of conversion. Check the quality for yourself:

// This is a comment
int main(int argc, char* argv[])
{
    cout << "Hello, RTF 2 HTML!" << endl;
    return 0;
}
   

I copied the html code from Firefox's View->Page Source window.
So, if you are curious, find the link to the converter below:
RTF to HTML Online
Another downside of the converter - bloating size of the resulting html. In the example above size changed from 516 bytes in rtf file to 1,698 bytes in the converted html file.

No comments:

Post a Comment