Is there a method to use preprocessor like h file in C/C++?

Hi !

I want to use a technic with JS like .h file in C/C++ and definitively, modify any label at a only one file or node...

For exemple, if i have an array from buffer IoT named o[] with 100 values ; in C, i will put in my header .h file :

#define temp1 o[0]
#define temp2 o[1]
#define temp3 o[2]
#define temp4 o[3]
#define temp100 o[99]

I found on the web this 'map' object :

map = {
    1: "FISH",
    2: "CHIPS",
    3: "EAT",
    4: "SLEEP",
    5: "CODE",
input = 5
alert(map[5]) // Will alert CODE, as required.

How can i adapt my case and if possible, where can i add this code ? :thinking:

Thank you very much,

Read up on node,js modules. They are files containing code, some or all of which you "export". When you "require" such a module in another node.js file, node.js imports the exported code & values.

ok thank you, i will see that :slight_smile:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.