I'm in search of a code which allows me to write packet/buffer stream to a char array or anything like that; currently I'm using this packet writer but it gives me a totally wrong buffer
(the message at the end of p and pUnicodeMessage are different, but they should look like)
Code:
	char* message = "Test message!";
	char name[30] = "system";
	int len = 45 + sizeof(message);


    LPacket p;
    p << 0x1C;
    p << short(len);
    p << int(0xffffffff);
    p << short(0xffff);
    p << 0x0;
    p << short(0x35);
    p << short(0x3);
    p << name; //we DO NEED to fill those 30 bytes even if they're zeros
    p << message; //just the message, no fill needed


    LogPacket("packet (wrong)",p.getData(),len);
    LogPacket("packet (correct)",(char*)(pUnicodeMessage),sizeof(pUnicodeMessage));


    //packet (wrong), Length: 49
    // 0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
    //-- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
    //1C 73 65 00 31 00 FF 73  65 00 FF FF 00 73 65 00
    //35 00 03 00 07 00 73 79  73 74 65 6D 00 0E 00 54
    //65 73 74 20 6D 65 73 73  61 67 65 21 00 6D 75 6E
    //69
    //
    //packet (correct), Length: 100
    // 0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
    //-- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
    //1C 64 00 FF FF FF FF FF  FF 00 00 35 00 03 53 79
    //73 74 65 6D 00 00 00 00  00 00 00 00 00 00 00 00
    //00 00 00 00 00 00 00 00  00 00 00 00 53 70 68 65
    //72 65 20 56 65 72 73 69  6F 6E 20 30 2E 35 36 63
    //20 5B 57 49 4E 33 32 5D  20 62 79 20 77 77 77 2E
    //73 70 68 65 72 65 63 6F  6D 6D 75 6E 69 74 79 2E
    //6E 65 74 00
So I almost give up the LPacket and still in search of a code that allow me to write to packet/buffer steam, basically to write char, short, int, char* and fixed size char*
(C++ is not my best lang thats why I searching and not coding it yet)

So if anyone know a good packet writer or know what is going wrong with LPacket I'd be glad

Thanks