i feel like such an amature again... what i'm trying to accomplish is to find the preriods in an ip address.
i've also try tried the strcmp() functioins but all i get is cannot covert from char to char*Code:#include<string.h> #include<iostream.h> #include<conio.h> void main() { void return_class(char ip[]); char ip[] = {"155.25.54.1"}; return_class(ip); } void return_class(char ip[]) { int sLength; char firstoctet[4]; // get string length sLength = strlen(ip); // loop character array retrieving all characters the // preceed the first period character for(int x = 0; x < sLength; x++) if(ip[x] == ".") cout<<"period"<<endl; getch(); }
no go there! how can i loop through a character array and compare that character with another?Code:if(strcmp(ip[x], ".") == 0)
Thank, (so frustrating, when its so simple in vb)
Regan




Reply With Quote