Get content of a header file hardcoded into a program as text

Viewed 53

I need to have a content of one of header files at compile time. Is it possible using, for example, #define or constexpr under Visual Studio 2015?

P.S> To clarify, why I need that: I have some config files which looks like this:

<ModelSettingsData version="1.0" xmlns="ded" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <Param name="lightOuterLanding[0]"  bus="L_ESS_DC"              load="200"/>
    <Param name="lightOuterLanding[1]"  bus="R_ESS_DC"              load="200"/>
    <Param name="lightOuterLanding[2]"  bus="TOWING_DC or APU_DC"   load="8"/>
    <Param name="lightOuterTaxi[0]"     bus="L_AC"                  load="92"/>
    <Param name="lightOuterTaxi[1]"     bus="R_AC"                  load="92"/>
    <Param name="lightOuterRwyOff[0]"   bus="L_AC"                  load="65"/>
    <Param name="lightOuterRwyOff[1]"   bus="R_AC"                  load="65"/>
</ModelSettingsData>

and the header file like this:

struct ElecLightPower {
    float lightOuterLanding[4];
    float lightOuterTaxi[2];
    float lightOuterRwyOff[2];
    // ...
};

I need to fill the structure from the header file with the data which is calculated using parameters from the config file. Now I read this header as text on the program init and do what I need (actually just count byte shifts for every parameter), but the problem comes when I update the header in source code, but forget to put updated version of that file in the folder with the binary. For that reason I just want somehow to get the content of .h file in my code, to not read it from the disk on runtime.

0 Answers
Related