Click here to Skip to main content
15,910,981 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Problem with dll... Pin
Richard Andrew x6417-Feb-09 2:00
professionalRichard Andrew x6417-Feb-09 2:00 
GeneralRe: Problem with dll... Pin
Member Ártemis17-Feb-09 4:56
Member Ártemis17-Feb-09 4:56 
GeneralRe: Problem with dll... Pin
Richard Andrew x6417-Feb-09 12:33
professionalRichard Andrew x6417-Feb-09 12:33 
GeneralRe: Problem with dll... Pin
Member Ártemis17-Feb-09 23:46
Member Ártemis17-Feb-09 23:46 
QuestionConvert const string& to CByteArray ? Pin
mmayur16-Feb-09 5:27
mmayur16-Feb-09 5:27 
AnswerRe: Convert const string& to CByteArray ? Pin
CPallini16-Feb-09 8:05
mveCPallini16-Feb-09 8:05 
GeneralRe: Convert const string& to CByteArray ? Pin
mmayur16-Feb-09 8:46
mmayur16-Feb-09 8:46 
GeneralRe: Convert const string& to CByteArray ? Pin
CPallini16-Feb-09 9:46
mveCPallini16-Feb-09 9:46 
mayur8u wrote:
But i'm looking for a const string conversion to CByteArray.


Are you talking about std::string?


mayur8u wrote:
Even if i use the CString conversion to CByteArray, is there any inbuilt methods rather than using the for loop.


Yes, you may use CByteArray methods SetSize and Getdata to copy the string content into the array buffer.
CString str = _T("Hi");
CByteArray arr;
int iSize = (str.GetLength()+1) * sizeof(TCHAR) 
arr.SetSize(iSize);
const BYTE * pByte = (const BYTE *) (LPCTSTR) str;
CopyMemory( arr.GetData(), pByte, iSize);


As usual, the test is up to you.

Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke

[My articles]

GeneralRe: Convert const string& to CByteArray ? Pin
mmayur16-Feb-09 10:02
mmayur16-Feb-09 10:02 
GeneralRe: Convert const string& to CByteArray ? Pin
CPallini16-Feb-09 10:51
mveCPallini16-Feb-09 10:51 
GeneralRe: Convert const string& to CByteArray ? Pin
mmayur16-Feb-09 11:27
mmayur16-Feb-09 11:27 
GeneralRe: Convert const string& to CByteArray ? Pin
mmayur17-Feb-09 9:15
mmayur17-Feb-09 9:15 
AnswerRe: Convert const string& to CByteArray ? Pin
frx9616-Feb-09 16:29
frx9616-Feb-09 16:29 
Questionneed a minor help in my program [modified] Pin
tksrules16-Feb-09 4:20
tksrules16-Feb-09 4:20 
GeneralRe: need a minor help in my program Pin
Perspx16-Feb-09 4:26
Perspx16-Feb-09 4:26 
QuestionRe: need a minor help in my program Pin
David Crow16-Feb-09 6:18
David Crow16-Feb-09 6:18 
AnswerRe: need a minor help in my program Pin
tksrules16-Feb-09 6:22
tksrules16-Feb-09 6:22 
GeneralRe: need a minor help in my program Pin
David Crow16-Feb-09 6:39
David Crow16-Feb-09 6:39 
GeneralRe: need a minor help in my program Pin
tksrules16-Feb-09 6:42
tksrules16-Feb-09 6:42 
JokeRe: need a minor help in my program Pin
CPallini16-Feb-09 11:01
mveCPallini16-Feb-09 11:01 
QuestionRe: need a minor help in my program Pin
David Crow16-Feb-09 11:05
David Crow16-Feb-09 11:05 
AnswerRe: need a minor help in my program Pin
CPallini16-Feb-09 11:15
mveCPallini16-Feb-09 11:15 
GeneralRe: need a minor help in my program Pin
Rajesh R Subramanian16-Feb-09 18:34
professionalRajesh R Subramanian16-Feb-09 18:34 
GeneralRe: need a minor help in my program Pin
CPallini16-Feb-09 21:27
mveCPallini16-Feb-09 21:27 
Questionencryption and description functions in C++ on sunOS [modified] Pin
suresh_r16-Feb-09 1:46
suresh_r16-Feb-09 1: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.