sounds like something that could have been more easily done in a higher level language, but it really doesn't matter. I've read C or text into a perl script that spits out some different C (eg, auto generating enums or reverse string versions thereof), lots of people do this for various purposes I believe. You could write a C/C++ compiler in C/C++ or some other language, not that this is quite the same but it is does demonstrate the machine is an effective tool this way (or can be).
My program gets an enum from file, writes it to a header (or source, if you so choose...) in a class, and provides a couple of member functions. One will retrieve a vector of strings containing all the enum values converted to strings, and the other will retrieve a specific enum value if you want to do it that way.