|
-
April 18th, 2011, 03:28 AM
#1
Avoiding hard coding of IP Address
Hi,
I wanted to avoid the hard coding of IP Address in my implementation using standard C. Instead I want to pass it so that I can connect to different remote hosts. Any example of how I can do this.
Regards
-
April 18th, 2011, 11:31 AM
#2
Re: Avoiding hard coding of IP Address
 Originally Posted by [email protected]
Hi,
I wanted to avoid the hard coding of IP Address in my implementation using standard C. Instead I want to pass it so that I can connect to different remote hosts. Any example of how I can do this.
Regards
On the command line:
Code:
myApp.exe 128.146.12.10
Viggy
-
May 17th, 2011, 01:53 AM
#3
Re: Avoiding hard coding of IP Address
#include <stdio.h>
int main(int argc, char *argv[])
{
if (argc != 2)
{
printf("\n Wrong arguments.. Enter ip address.");
}
char *printerIP;
printerIP = argv[1];
printf("\n printerIP is %s ",printerIP);
getchar();
return 0 ;
}
-
May 17th, 2011, 01:54 PM
#4
Re: Avoiding hard coding of IP Address
 Originally Posted by [email protected]
Hi,
I wanted to avoid the hard coding of IP Address in my implementation using standard C. Instead I want to pass it so that I can connect to different remote hosts. Any example of how I can do this.
Regards
What if you have a long list of remote IP addreses you want to connect ? I agree hardcoding takes time and mind to deal with. What application are you working on, actually ? Because I think sometimes it depends on the actual modules you try to implement too so you need to be a little choosey for which method is more appropriate.
hi,,,
-
May 18th, 2011, 10:26 AM
#5
Re: Avoiding hard coding of IP Address
There's no need for hardcoding
- Enter on the command line
- Enter into a list box (GUI)
- Enter into a side file
These are just a few alternatives.
Viggy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|