Concatenation unsigned characters

Hello,

I need a small program in C + + that sends and receives frames from an Ethernet interface (using WinPcap or other). Please if anyone has a source code that can help me to save time and make better progress because I am a beginner in C + + and I really need this part of programming to accomplish other work.

Otherwise try the meantime, i started coding using Visual C + + 2010. But I still have a little problem because in the transport layer I need to build an UDP packet so I have to concatenate the UDP header with the message that I want to send.

I thought about the function strcat (string1, string2) but it was not the solution because my character variables are unsigned and this function can only concatenate strings signed. So I thought to put them in a structure as follows

struct packetUDP
{
unsigned short UDPportSrc;
unsigned short UDPportDest;
unsigned short UDPlength;
unsigned short UDPchecksum;
unsigned char message [500];
};

Is this the right solution please? Otherwise how I am doing. Because I also thought of the function

void * memcpy (void * destination, const void * source, size_t num);

my question can be stupid :( but I really need your help please. thank you for your time.



Last edited on
English please.
done :)
wow...
i'm not perfect programmer , but i think this is harder than you could will .
more harder....
Topic archived. No new replies allowed.