What i am trying to to is the following
when user inputs ./test U www.google.com I <ip here>
same for ./test U <URL here> I <IP here>
using command line input argv and argc here is what i have done so far,
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
struct str_pair
{
char ip [50];
char uri [50];
str_pair *next;
int counter;
};
str_pair *str_ptr;// pointer to an order struct,
str_pair *list_head;// points to nothing initially.
const int list_size=; i need to know the list size!!
int main(int argc, char *argv[])
{
if (argc == 1)
{ cout << "my name"<<endl;
return(0);
}
//--- initialize link list to empty.
list_head = NULL;// can test for NULL to see if anything is there.
//str_ptr = new str_pair; //--- Create data at run time on the heap.
for (int i=0; i<list_size; i++)
{
str_ptr = list_head; // save old head of list.
list_head = new str_pair; // create new item.
list_head->next= str_ptr; // get next item to point to previous head.
list_head->counter =i;
}
strcpy(
str_ptr=list_head;
while(str_ptr != NULL)
{if(strcmp
return(0);
}
also a hint when where is showed add the ip addresses and uri.