Click here to Skip to main content
16,008,010 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: I Need help with Reading a binary file Pin
Todd Smith21-Sep-02 11:53
Todd Smith21-Sep-02 11:53 
GeneralRe: I Need help with Reading a binary file Pin
Licensed2Code21-Sep-02 16:38
sussLicensed2Code21-Sep-02 16:38 
GeneralRe: I Need help with Reading a binary file Pin
Todd Smith23-Sep-02 5:52
Todd Smith23-Sep-02 5:52 
Generalrefereced classes Pin
xai21-Sep-02 6:26
xai21-Sep-02 6:26 
GeneralDoubt in Radiobuttons Pin
arthivjii21-Sep-02 5:07
arthivjii21-Sep-02 5:07 
GeneralRe: Doubt in Radiobuttons Pin
Pavel Klocek21-Sep-02 5:19
Pavel Klocek21-Sep-02 5:19 
GeneralRe: Doubt in Radiobuttons Pin
Brian Delahunty21-Sep-02 6:22
Brian Delahunty21-Sep-02 6:22 
GeneralReplacing chars in CString (hex) Pin
User 665821-Sep-02 4:04
User 665821-Sep-02 4:04 
Hi!

currently I'm programming an app that sends packets to (game)servers. Some packets look like this:
"\x12\x02trb2", which means that they contain hexadecimal values.

If I define them in my program like this:
LPCTSTR PACKETS[NUMPACKETS] =
{
     (...)           // other packets
     "\x12\x02trb2"  // tribes2, hexadecimal
};

they get sent correctly. But I want my program to be more dynamic and let the user specify own packets that he wants to send to a server.
Of course, when the user types "\x12\x02trb2" into an edit box the packet will not be sent hexadecimal but as a complete string.

So I tried to replace the most important escape sequences in the edit box like this:
string.Replace("\\0", "\0");
string.Replace("\\t", "\t");
string.Replace("\\x", "\x");
string.Replace("\\n", "\n");
string.Replace("\\r", "\r");


All lines conpile fine, except the 3rd one. The compiler error is (translated from german):
error C2153: Hexadecimal constants need to contain at least one hexadecimal number


Does anybody know how I can get this to work?

thanks in advance
Greg

modified 12-Sep-18 21:01pm.

GeneralRe: Replacing chars in CString (hex) Pin
Pavel Klocek21-Sep-02 4:19
Pavel Klocek21-Sep-02 4:19 
GeneralRe: Replacing chars in CString (hex) Pin
User 665821-Sep-02 4:33
User 665821-Sep-02 4:33 
GeneralRe: Replacing chars in CString (hex) Pin
Pavel Klocek21-Sep-02 4:44
Pavel Klocek21-Sep-02 4:44 
GeneralRe: Replacing chars in CString (hex) Pin
User 665821-Sep-02 5:29
User 665821-Sep-02 5:29 
GeneralRe: Replacing chars in CString (hex) Pin
Pavel Klocek21-Sep-02 5:47
Pavel Klocek21-Sep-02 5:47 
GeneralRe: Replacing chars in CString (hex) Pin
User 665821-Sep-02 5:51
User 665821-Sep-02 5:51 
GeneralRe: Replacing chars in CString (hex) Pin
Pavel Klocek21-Sep-02 6:02
Pavel Klocek21-Sep-02 6:02 
GeneralRe: Replacing chars in CString (hex) Pin
User 665821-Sep-02 6:06
User 665821-Sep-02 6:06 
GeneralRe: Replacing chars in CString (hex) Pin
Pavel Klocek21-Sep-02 6:13
Pavel Klocek21-Sep-02 6:13 
GeneralThank you very much Pin
User 665821-Sep-02 6:15
User 665821-Sep-02 6:15 
GeneralRe: Thank you very much Pin
Pavel Klocek21-Sep-02 6:19
Pavel Klocek21-Sep-02 6:19 
GeneralRe: Replacing chars in CString (hex) Pin
Michael Dunn21-Sep-02 5:53
sitebuilderMichael Dunn21-Sep-02 5:53 
GeneralWindow background Pin
suresh_sathya21-Sep-02 3:16
suresh_sathya21-Sep-02 3:16 
GeneralRe: Window background Pin
Dominik Reichl21-Sep-02 4:26
Dominik Reichl21-Sep-02 4:26 
GeneralSocket connection via PROXY server Pin
Chintan21-Sep-02 3:13
Chintan21-Sep-02 3:13 
GeneralRe: Socket connection via PROXY server Pin
Joaquín M López Muñoz21-Sep-02 8:31
Joaquín M López Muñoz21-Sep-02 8:31 
Generalshared memory and MFC Pin
nss21-Sep-02 2:37
nss21-Sep-02 2:37 

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.