Click here to Skip to main content
16,005,080 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralConvert CString to Integer Pin
Anonymous20-Dec-04 19:46
Anonymous20-Dec-04 19:46 
GeneralRe: Convert CString to Integer Pin
SivaramanDhamodharan20-Dec-04 19:58
SivaramanDhamodharan20-Dec-04 19:58 
GeneralRe: Convert CString to Integer Pin
Jon Hulatt20-Dec-04 21:56
Jon Hulatt20-Dec-04 21:56 
GeneralRe: Convert CString to Integer Pin
David Crow21-Dec-04 2:01
David Crow21-Dec-04 2:01 
GeneralRe: Convert CString to Integer Pin
Jon Hulatt21-Dec-04 5:19
Jon Hulatt21-Dec-04 5:19 
GeneralRe: Convert CString to Integer Pin
Renjith Ramachandran20-Dec-04 20:37
Renjith Ramachandran20-Dec-04 20:37 
GeneralProblems with appending, copying usigned char* data ----Pls help Pin
ledallam20-Dec-04 19:28
ledallam20-Dec-04 19:28 
GeneralRe: Problems with appending, copying usigned char* data ----Pls help Pin
Jon Hulatt20-Dec-04 22:05
Jon Hulatt20-Dec-04 22:05 
I'm not really motivated to go through your code line by line.

But I don't get why you're working with both CString and also char * buffers and libc string functions. I'd say stick with one or the other.

using _mbs???() functions is wrong. They're for wide character sets, and you're dealing with byte data.

1. You want a \r\n at the end of your string? Put it in your format string:-
CString szMsg;
szMsg.Format("%02X%02X%02X%02X%02X%02X%02X<font color="red">\r\n</font>", cBuffer[0], cBuffer[1], cBuffer[2],cBuffer[3], cBuffer[4], cBuffer[5], cBuffer[6]); 


or, you can use CString's "+" operater to join two strings:-

CString szMsg;
szMsg.Format("%02X%02X%02X%02X%02X%02X%02X", cBuffer[0], cBuffer[1], cBuffer[2],cBuffer[3], cBuffer[4], cBuffer[5], cBuffer[6]);
szMsg = szMsg + "\r\n"; 


2. Not using _mbscpy

I don't know where you get your "len" variable from. But use strcpy() instead.
unsigned char* myBuffer = new unsigned char[len];
strcpy(myBuffer, cBuffer);



Those things should help.

Jon


using System.Beer;

Generalwebservice Pin
hou_12620-Dec-04 19:03
hou_12620-Dec-04 19:03 
QuestionCreating an ActiveX? Pin
dSolariuM20-Dec-04 18:41
dSolariuM20-Dec-04 18:41 
GeneralAbout CEdit::LineLength Pin
freehawk20-Dec-04 18:28
freehawk20-Dec-04 18:28 
GeneralRe: About CEdit::LineLength Pin
David Crow21-Dec-04 2:07
David Crow21-Dec-04 2:07 
Generalownderdraw Pin
Tripura.K20-Dec-04 18:21
Tripura.K20-Dec-04 18:21 
GeneralEncrypting Video File Data Pin
Naveed Shoaib20-Dec-04 18:19
Naveed Shoaib20-Dec-04 18:19 
GeneralRe: Encrypting Video File Data Pin
Antti Keskinen20-Dec-04 22:34
Antti Keskinen20-Dec-04 22:34 
Questionhow to associate MFC with lex and yacc? Pin
chenbuaa20-Dec-04 16:40
chenbuaa20-Dec-04 16:40 
AnswerRe: how to associate MFC with lex and yacc? Pin
David Crow21-Dec-04 2:18
David Crow21-Dec-04 2:18 
GeneralResource related crash Pin
JWood20-Dec-04 13:30
JWood20-Dec-04 13:30 
GeneralRe: Resource related crash Pin
Ryan Binns20-Dec-04 17:01
Ryan Binns20-Dec-04 17:01 
GeneralDrawDragRect Pin
poiut20-Dec-04 10:51
poiut20-Dec-04 10:51 
GeneralRe: DrawDragRect Pin
JWood20-Dec-04 13:37
JWood20-Dec-04 13:37 
GeneralRe: DrawDragRect Pin
poiut22-Dec-04 6:29
poiut22-Dec-04 6:29 
QuestionWhy is my printed image blown up? Pin
giannibal20-Dec-04 9:49
giannibal20-Dec-04 9:49 
GeneralHelp me with image displaying solutions Pin
Budric B.20-Dec-04 7:44
Budric B.20-Dec-04 7:44 
GeneralAlso... Pin
Budric B.20-Dec-04 7:49
Budric B.20-Dec-04 7:49 

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.