Alright, I have just now found I have a problem with char and int. If I wanted to enter an IP like 127.0.0.1 as Int it would read it as a charecter, if i had char it would read as an Integer. How do I use both at the same time
Alright, I have just now found I have a problem with char and int. If I wanted to enter an IP like 127.0.0.1 as Int it would read it as a charecter, if i had char it would read as an Integer. How do I use both at the same time
huh?
You need to provide details. And I'd suggest asking this question in the networking forum.
I guess you could store the IP in a string...if that's what you're asking.
Well, there are a few things wrong with your code:
1) It does not work.
2) It does not work.
3) It does not work.
Hope this helps.
You could create a class that would allow you to quickly retrieve any aspect of it with a function call.
Although that may be overkill. I just love classes.Code:class IPaddr { public: int num[4]; char *str(); char *str(int nIndex); }; char * IPaddr::str() { char *temp=new char[32]; itoa(num[0],temp,10); //etc } char *IPaddr::str(int nIndex) { char *temp=new char[4]; itoa(num[nIndex],temp,10); return temp; }
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials