Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » TcpSocket, Know when distant connection have been closed
Re: TcpSocket receiving ghost data [message #57217 is a reply to message #57216] Sat, 12 June 2021 17:34 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1094
Registered: August 2007
Senior Contributor
Hello Xemuth,

That's because that function is meant to convert pointer addresses into hexadecimal notation. What you see is a representation of the address of "data" String. What you need is HexEncode/HexDecode:

CONSOLE_APP_MAIN
{
	StdLogSetup(LOG_COUT|LOG_FILE);
	
	String s = "A";
	RLOG(s);
	RLOG(FormatHex(~s));                   // Converts the pointer address to hex.
	RLOG(FormatHex(s.ToStd().c_str()));    // Converts the pointer address to hex.
	RLOG("---");
	RLOG(HexEncode(s));                    // Encodes the *content* of Strings into hex.
	RLOG(HexEncode(s.ToStd().c_str()));    // The same...
}



result:

A
7fff1bbab9a8
7fff1bbab958
---
41
41




Best regards,
Oblivion


[Updated on: Sat, 12 June 2021 17:38]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: RichEdit with word wrap?
Next Topic: Calendar
Goto Forum:
  


Current Time: Sun Jun 09 10:27:57 CEST 2024

Total time taken to generate the page: 0.02211 seconds