I'm not sure that I formulate the question correctly.

Suppose there is a program that uses a specific ip-address from the internal network for requests.

SOCKADDR_IN address; address.sin_addr.S_un.S_addr=inet_addr("тут используется этот самый адрес"); 

Is it possible to somehow change the program so that when it is compiled with certain parameters, the ip-address value itself changes in the finished file (.exe).

I can not even understand which way to google. Please tell in which direction to look for information.

    1 answer 1

    For example, a macro defined when compiling on the command line.

     int main(int argc, const char * argv[]) { printf("%d\n",VALUE); } 

    If you compile in VC ++ as

     cl -DVALUE=256 test.cpp 

    there will be a program outputting 256. If

     cl -DVALUE=123 test.cpp 

    will output 123.

    But isn't it more reasonable to pass this parameter, say, on the command line?

    • Thank you. It was a pure interest to know for the future how it is realized. - R. Key