I’m trying to use #define to define a string literal (a filepath in this case), but I cannot get the path FROM another #define’d element. In short, I’d like something like this:
#define X /var/stuff
#define Y "X/stuff.txt"
To give me Y as "/var/stuff/stuff.txt". Is this even possible to do? Thanks beforehand.
EDIT: Alternatively, would something like this concat the two literals into one?
#define X "/var/stuff"
#define Y X"/stuff.txt"
Not the way you have it, no — macro replacement does not happen inside string literals.
You can, however, paste together a string from pieces:
Quick demo code for this: