Hi I've tried for a few hours to figure this out - but the solution is escaping me.
This is a snippet of code for a program I am writing in C. iServerListenPort has been previously assigned.
Here is the code that does not work. It crashes after entering the IP address
Code:
char *serverip;
printf("Please enter a IP address of the server you wish to connect to\n");
scanf("%s",&serverip);
printf("\nConnecting to %s Port %d\n", serverip, iServerListenPort);
if(ClientSocketObject.Connect(serverip , iServerListenPort))
{
printf("Client Connected\n");
}
This code Does work
Code:
char *serverip = "192.168.2.179";
printf("\nConnecting to %s Port %d\n", serverip, iServerListenPort);
if(ClientSocketObject.Connect(serverip , iServerListenPort))
{
printf("Client Connected\n");
}
Here is the definition for socketobject.connect
Code:
bool Connect(char* szServerAddress, int iPort)
Thank-You very much for any help!!