nulloverflow
October 19th, 2004, 08:14 AM
For those of you who use mIRC, you know when you press ctrl+k you can select a color and your text will appear in that color. What mIRC actually does is prepend the text with a single char, then the color numbers and text. The character prepended is character 3 (from the ASCII table). Since this char is unprintable it shows up as a little box in mIRC (depending on font). My question is this: How can i copy an unprintable character (like chr(3)) to a char*.
Here is a little snippet that causes my DLL to crash mIRC:
------------------------------------------------------
1: char colorcode = (char) 3; // char 3 = ctrl+k
2: strcpy(data,colorcode); // data is a var defined elsewhere
3: strcat(data,CC_BLUE) // CC_BLUE is defined elsewhere as "02";
4: strcat(data,text) // text containts...um..text
5: AppendWindowBuffer(hWnd,data) // Append the window
------------------------------------------------------
If i comment out line 2, and change line 3 to strcpy the program runs with no problems, but if i leave it as is, it crashes when it try to copy colorcode.
Any/All help is appreciated.
-James
Here is a little snippet that causes my DLL to crash mIRC:
------------------------------------------------------
1: char colorcode = (char) 3; // char 3 = ctrl+k
2: strcpy(data,colorcode); // data is a var defined elsewhere
3: strcat(data,CC_BLUE) // CC_BLUE is defined elsewhere as "02";
4: strcat(data,text) // text containts...um..text
5: AppendWindowBuffer(hWnd,data) // Append the window
------------------------------------------------------
If i comment out line 2, and change line 3 to strcpy the program runs with no problems, but if i leave it as is, it crashes when it try to copy colorcode.
Any/All help is appreciated.
-James