Please show me
... the function prototype for the function you're trying to pass the command line arguments to.
... your function main definition (the first line of the function; the one that looks like a prototype).
... the line from within main where you call that function and pass it the command line arguments.
Make sure the prototype line occurs before the definition of the main function.
prototype....
void getRncIpAddressAndPort( SIpta &ipta_rnc,int option,char **argv );
Function definition....sme changes are made by me....
void getRncIpAddressAndPort( SIpta &ipta_rnc,int option,char **argv )
{
int ip1oct,ip2oct,ip3oct,ip4oct ;
u32 udpport;
cout<<"the function entered"<<endl;
//cout<<"Please enter the RNC IP Address"<<endl;
char dot;
//cout<<*argv1<<endl;
do
{
cout<<"while loop entered"<<endl;
//cout<<"Valid Entry for Octets is between 0-255"<<endl;
//cin>>ip1oct>>dot>>ip2oct>>dot>>ip3oct>>dot>>ip4oct ;
if( (option == 4) || (option == 8) || (option == 9) )
{
cout<<"if loop entered"<<endl;
int Result;
//char* value;
//value = *(++argv);
//cout<<value<<endl;
if (StringToInt(++*argv), Result))
{
ip1oct = Result;
cout << "The string value is " <<*(++*argv)<< " and the int value is " << Result << endl;
}
else
{
cout << "Number conversion failed" <<endl;
}
//ip1oct = int(*(++argv));
dot = char(*(++argv));
ip2oct =int(*(++argv));
dot = char(*(++argv));
ip3oct =int(*(++argv));
dot = char(*(++argv));
ip4oct = int(*(++argv));
udpport = u32(*(++argv));
}
/* if( ((int(*argv1)) == 5) || ((int(*argv1)) == 6) )
{
ip1oct = int(*(++argv));
dot = char(*(++argv));
ip2oct =int(*(++argv));
dot = char(*(++argv));
ip3oct =int(*(++argv));
dot = char(*(++argv));
ip4oct = int(*(++argv));
udpport = u32(*(++argv));
}
if( ((int(*argv1)) == 7) || ((int(*argv1)) == 11) )
{
ip1oct = int(*(++argv));
dot = char(*(++argv));
ip2oct =int(*(++argv));
dot = char(*(++argv));
ip3oct =int(*(++argv));
dot = char(*(++argv));
ip4oct = int(*(++argv));
udpport = u32(*(++argv));
}*/
}
while ( !((ip1oct<=255)&&(ip2oct<=255)&&(ip3oct<=255)&&(ip 4oct<=255)));
SAal2sIpAddress ipAddress;
ipAddress.u.ipv4Address.ipa[0]= (u8)ip1oct;
ipAddress.u.ipv4Address.ipa[1]= (u8)ip2oct;
ipAddress.u.ipv4Address.ipa[2]= (u8)ip3oct;
ipAddress.u.ipv4Address.ipa[3]= (u8)ip4oct;
ipAddress.type = EAal2sIpAddressType_ipv4;
ipAddress.length = 4;
ipta_rnc.ipAddress = ipAddress;
//cout <<"Please enter RNC UDP Port (49152-63135)"<<endl;
//cin >> udpport ;
while( udpport<49152 || udpport>63135 )
{
cout <<"Wrong RNC UDP Port Range-(49152-63135)"<<endl;
cout <<"Please enter again RNC UDP Port with in range (49152-63135)"<<endl;
//cin>>udpport;
}
ipta_rnc.udpPort = udpport;
}