So i have the following code:
//main program
char username[15] = {'r','g','f','i','r','e','f','l','y','2','4'};
char password[9] = {'1','2','3','4','5','6','7','8'};
if(client.Send(15,9,username,password))
{
printf("Connection Successfully Established");
}
//class file
bool Class_Name::Send(int usize, int psize, char *username, char *password)
{
itoa(usize,sendbuffer,16); // works fine
itoa(psize,sendbuffer + 1,16); // works fine
for(int i = 0; i< usize; i++)
{
sendbuffer[i+2] = *(username + i); //works fine
}
int x=2+usize;
for(int H = 0; H<psize;H++)
{
sendbuffer[H+x] = *(password + H); // does not work
}
SentBytes = send(client_socket, sendbuffer, strlen(sendbuffer), 0);
if (SentBytes == SOCKET_ERROR)
{
return false;
}
return true;
}
Basically the part where i put does not work doesn't input the information from the password const char * to the array and i'm not sure why it doesn't