Page 1 of 1

C++ String Converter

Posted: Thu Dec 06, 2007 4:48 pm
by BlindSide
Any of you ever tried sticking a gigantic, multi-page string in C++ source? Its very annoying, you have to manually add new lines and " at every line! Well I got sick of it so I decided to check out wxDevCPP's dialog making capabilities, and infact, it was very nice and easy to use, and I made this app in minutes.

Basically, paste your string inside the "Input" textbox and press "Convert" or "Convert and auto-copy" and it will convert your string so that it can be used in C++ source straight away!

Eg

Original String:

Code: Select all

Blah
Blah
Blah
Converted String:

Code: Select all

"Blah\n"
"Blah\n"
"Blah\n"
There was one tiny problem with wxDevCPP, however. Even with best optimisations and debug mode disabled, this simple exe ended up at 3mb! :shock:

Anyway, I hope someone finds this useful, get it here: http://irrlichtirc.g0dsoft.com/BlindSid ... verter.zip

Cheers

Posted: Thu Dec 06, 2007 9:12 pm
by MasterGod
It could be useful, thanks.

Posted: Sat Feb 02, 2008 11:03 am
by z4rd0z
Linux version:

Code: Select all

sed "s/\(.*\)/\"\1\\\n\"/" inputfile.txt >outputfile.c
:wink:

Posted: Sat Feb 02, 2008 3:29 pm
by BlindSide
Nice, thanks for that.