Код: Выделить всё
//define some pre-processor string consts
#define I2C_DEVICE_BASE_PATH "/sys/devices/platform/soc/9c0000.qcom,qupv3_0_geni_se/984000.i2c/i2c-1/"
#define DISPLAY_DEV_ID_PORT0 "1-002b"
#define DISPLAY_DEV_ID_PORT1 "2-002f"
//the typical "stringification" trick that's posted on here
#define S(x) #x
#define STR(xx) S(xx)
//the macro I'm trying to make work...
#define DISPLAY_DEVICE_BASE_PATH(port) STR(I2C_DEVICE_BASE_PATH) STR(DISPLAY_DEV_ID_PORT##port)
Код: Выделить всё
01-21 20:16:46.135 7236 7236 E QdispControl: can't open file "/sys/devices/platform/soc/9c0000.qcom,qupv3_0_geni_se/984000.i2c/i2c-1/""1-002b"/5v
Есть ли более удобный способ сделать это, или я ожидаю слишком многого от возможностей процессора CPP по смешиванию строк?>
Подробнее здесь: https://stackoverflow.com/questions/798 ... -processor
Мобильная версия