Go Down

Topic: [SOLVED] Using a define in a string? (Read 452 times) previous topic - next topic

gregmcc

Jul 29, 2013, 06:14 pm Last Edit: Jul 29, 2013, 06:19 pm by GregM Reason: 1
Don't know if I have the correct terminology here but I have the following code that contains a key and some other characters.

Code: [Select]
char cbuff[]= "?key=N5LJF5L95VT35V5&field1=00.00&field2=0000&field3=00.00&field4=00.00&field5=00.00";

For easier use I want to have something like the following:

Code: [Select]

#define key = "N5LJF5L95VT35V5"
char cbuff[]= "?key=" $key + "&field1=00.00&field2=0000&field3=00.00&field4=00.00&field5=00.00";


Obviously the syntax is way off but I want to use the define in the key but can't work out how to do it.


AWOL

Code: [Select]
#define key  "N5LJF5L95VT35V5"
char cbuff[]= "?key=" key "&field1=00.00&field2=0000&field3=00.00&field4=00.00&field5"

gregmcc

Thanks, that was embarrassingly easy :)

Go Up