// Official server
# Define API_DOMAIN @ "www.online.com"
// Test the server
// # Define DOMAINXX @ "192.168.0.10"
# Define API_SYSTEM @ "http: //" API_DOMAIN @ "/system /"
# Define API_USER @ "http: //" API_DOMAIN @ "/user /"
After the launch of the API_SYSTEM macro, @ "http: //" @ "www.online.com" @ "/system /"
The compiler automatically connects the characters for the purpose.
Implementation in C language:
// Official server
# Define API_DOMAIN "www.online.com"
// Test the server
// # Define DOMAINXX "192.168.0.10"
# Define API_SYSTEM "http: //" API_DOMAIN "/system /"
# Define API_USER "http: //" API_DOMAIN "/user /"
Refer:
Http://stackoverflow.com/questions/8844981/how-to-expand-a-macro-into-nsstring-without-using-any-string-concatenation-at-ru
Http://stackoverflow.com/questions/798221/c-macros-to-create-strings
Finally, I would like to thank the omnipotent google and the omnipotent stackoverflow.