C++ String Converter

A forum to store posts deemed exceptionally wise and useful
Post Reply
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

C++ String Converter

Post 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
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

It could be useful, thanks.
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
z4rd0z
Posts: 11
Joined: Sat Jan 12, 2008 9:11 am

Post by z4rd0z »

Linux version:

Code: Select all

sed "s/\(.*\)/\"\1\\\n\"/" inputfile.txt >outputfile.c
:wink:
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Nice, thanks for that.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Post Reply