Click here to Skip to main content
15,909,651 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Stop removal of null characters Pin
Tom Wright25-Aug-04 11:48
Tom Wright25-Aug-04 11:48 
GeneralRe: Stop removal of null characters Pin
Michael Dunn25-Aug-04 10:52
sitebuilderMichael Dunn25-Aug-04 10:52 
GeneralRe: Stop removal of null characters Pin
Tom Wright25-Aug-04 11:23
Tom Wright25-Aug-04 11:23 
GeneralRe: Stop removal of null characters Pin
Michael Dunn25-Aug-04 12:02
sitebuilderMichael Dunn25-Aug-04 12:02 
GeneralRe: Stop removal of null characters Pin
Tom Wright26-Aug-04 6:14
Tom Wright26-Aug-04 6:14 
GeneralRe: Stop removal of null characters Pin
Joaquín M López Muñoz25-Aug-04 12:45
Joaquín M López Muñoz25-Aug-04 12:45 
GeneralRe: Stop removal of null characters Pin
Tom Wright26-Aug-04 6:00
Tom Wright26-Aug-04 6:00 
GeneralRe: Stop removal of null characters Pin
Abin26-Aug-04 1:21
Abin26-Aug-04 1:21 
As far as I can think, the closest solution should be replacing those null's with some other characters those otherwise will never be used in your application, for example, if your sure you'll never use the character '#', then:
// how long is your header gonna be, then how many #'s here
#define THE_HEADER _T("###...##")

// To make your packet:
CString sPacket = CString(THE_HEADER) + _T("your real contents");

// Now send your packet
socket.Send((LPCVOID)(LPCTSTR)sPacket, sPacket.GetLength() * sizeof(TCHAR));

// And the receiver then replace the #'s with null's
TCHAR szReceived[1024] = _T("");
receiver.Receive((LPVOID)szReceived, 1023); // suppose 1023 is enough
for (int i = 0; szReceived[i]; i++)
{
    if (szReceived[i] == _T('#'))
        szReceived[i] = _T('\0');
}

// Now you get what you want

GeneralRe: Stop removal of null characters Pin
GKarRacer26-Aug-04 8:05
GKarRacer26-Aug-04 8:05 
GeneralWow this is a mess Pin
palbano25-Aug-04 18:55
palbano25-Aug-04 18:55 
GeneralRe: Wow this is a mess Pin
Tom Wright26-Aug-04 5:54
Tom Wright26-Aug-04 5:54 
GeneralRe: Wow this is a mess Pin
palbano26-Aug-04 7:59
palbano26-Aug-04 7:59 
GeneralWindow Position Pin
Anthony988725-Aug-04 8:54
Anthony988725-Aug-04 8:54 
GeneralRe: Window Position Pin
Maximilien25-Aug-04 9:00
Maximilien25-Aug-04 9:00 
GeneralRe: Window Position Pin
Anthony988725-Aug-04 9:07
Anthony988725-Aug-04 9:07 
QuestionSaving password to registry? Pin
mcguile25725-Aug-04 8:16
mcguile25725-Aug-04 8:16 
AnswerRe: Saving password to registry? Pin
Antony M Kancidrowski25-Aug-04 9:48
Antony M Kancidrowski25-Aug-04 9:48 
AnswerRe: Saving password to registry? Pin
David Crow25-Aug-04 10:19
David Crow25-Aug-04 10:19 
GeneralRe: Saving password to registry? Pin
darkbyte25-Aug-04 10:36
darkbyte25-Aug-04 10:36 
GeneralRe: Saving password to registry? Pin
David Crow25-Aug-04 10:52
David Crow25-Aug-04 10:52 
GeneralRe: Saving password to registry? Pin
darkbyte26-Aug-04 5:00
darkbyte26-Aug-04 5:00 
AnswerRe: Saving password to registry? Pin
cmk25-Aug-04 13:22
cmk25-Aug-04 13:22 
AnswerRe: Saving password to registry? Pin
l a u r e n25-Aug-04 15:45
l a u r e n25-Aug-04 15:45 
GeneralRe: Saving password to registry? Pin
ThatsAlok25-Aug-04 21:53
ThatsAlok25-Aug-04 21:53 
GeneralRe: Saving password to registry? Pin
darkbyte26-Aug-04 4:46
darkbyte26-Aug-04 4:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.