[Question]C++ Arrays

Joined
Mar 26, 2006
Messages
603
Reaction score
7
Edit: I've come up with an alternative way, counting the occurrence of a substr. Then passing that to the for loop. I'm not going to delete this post just in case someone else seems to be trying to do the same thing and cant think of any alternatives.

I've been looking around and couldn't find nothing. Basically what I'm doing is building an array, then passing it to char array to send over a socket, once it gets to the other end I'm wanting to pull it back together for use.
EX: (This is the server side)
Code:
if(strstr(buff,"UUL")) {
	string user_list[2];
	for(int c = 0;c < c_id;c++) {
		user_list[c] = client_list[c].username;
	}
	sprintf(sendData,"%s",user_list);
	for(int c = 0;c < c_id;c++)  {
		send(client_list[c].client,sendData,sizeof(sendData),0);
	}
}
Upon client side receiving it, I'm wanting to pull it back together as user_list.
If there is a better route, please let me know. Just give me a link and I'll read away.
If you know how to do this and you answer my question, please explain to me how you've done it. I'd rather learn than copy and pasting.
Thanks in advance.
P.S. If I find a fix for what I'm wanting to do I'll edit this so no one wastes their time with responding once I've already found a way.
 
Last edited:
Back