Two Open Source (BSD) utilities I wrote

Started by
10 comments, last by Starfox 13 years, 3 months ago
I recently cleaned up and uploaded a couple of small utilities I wrote to help me with work to BitBucket. The first, "Text to C String", takes a text file as input and outputs a string suitable for embedding in a C[++] file. I use it to embed shaders into my code as const char*s, so that small demo apps I write end up self contained. The second, "Binary to C Array", does a similar thing for binary files - it turns them into an unsigned char array (like "{ 0x0A, 0x07, 0x1B }") suitable for embedding in a source file. I use this to embed other binary dependencies like Ogg files into my exe, again for the sake of having a single simple, self contained application. I hope someone would find them useful.

Text to C String


Binary to C Array
Holy crap I started a blog - http://unobvious.typepad.com/
Advertisement
Those are cool! I make little utilities like those all the time. I'm glad to see someone else does this too, so now I don't feel so weird. I've had this great idea for a data packager or archiver utility with script-able inputs and outputs. Similar to your programs, this would read a script or XML definition of a file format and rip the contents to another. Useful for file conversions. But... like most pet projects of mine, it will most likely never get built because I play to many video games and other stuff.
Thanks. I have a ton of things like that, and I decided to start open sourcing them bit by bit based on dependencies. Hope other people find them useful.
Holy crap I started a blog - http://unobvious.typepad.com/
BTW, if someone could add build tools files for OS X or other platforms, please do!
Holy crap I started a blog - http://unobvious.typepad.com/

BTW, if someone could add build tools files for OS X or other platforms, please do!


Huh? It looks to be standard C++; just pop the source file in a default console project from your favorite IDE and hit compile.
Yup, I take great care to write ANSI C++. I want to save people the "pop the source file in a default console project" step with popular IDEs / build platforms. CMake and XCode files would be awesome.
Holy crap I started a blog - http://unobvious.typepad.com/

Yup, I take great care to write ANSI C++. I want to save people the "pop the source file in a default console project" step with popular IDEs / build platforms. CMake and XCode files would be awesome.


CMake files and XCode files are two orthogonal topics. CMake is a meta-makefile-thingy that can generate a wide range of "project-files", like good old makefiles, xcode files, msvc files, etc.

I can only recommend to get in touch with stuff like CMake, autotools, qmake. It is valuable knowledge.
I'm quite familiar with CMake, but I haven't seen it able to produce Visual Studio files with the customizations I need, and I assumed XCode and VS would deserve custom files made since they cover a wide standardized market share. Autotools and qmake need to be taken out back and shot.
Holy crap I started a blog - http://unobvious.typepad.com/
You might also be interested in a little project I made, which does similar things: http://bitbucket.org/edd/embd
You give it a list of files on the command line and it generates a source/header pair, which you can compile and link in to your application in order to access the embedded files as std::istreams or byte-iterator ranges.
The original version of those started out VERY similar to embd. I made this new version to be simpler, lighter weight and easy to integrate in a pipeline with stdin / stdout redirection. We seem to share a lot of views though, and I have to say that you're one of the very, VERY few people I've seen who actually understand C++.
Holy crap I started a blog - http://unobvious.typepad.com/

This topic is closed to new replies.

Advertisement