Click here to Skip to main content
16,007,163 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: adding text to multiline text box. Pin
Jose Lamas Rios8-Aug-05 20:30
Jose Lamas Rios8-Aug-05 20:30 
GeneralRe: adding text to multiline text box. Pin
Member 34198918-Aug-05 20:38
Member 34198918-Aug-05 20:38 
QuestionHow to make form border invisible ? Pin
Amarelia8-Aug-05 18:38
Amarelia8-Aug-05 18:38 
AnswerRe: How to make form border invisible ? Pin
Jose Lamas Rios8-Aug-05 20:07
Jose Lamas Rios8-Aug-05 20:07 
Generaltype conversion Pin
Member 20725788-Aug-05 18:30
Member 20725788-Aug-05 18:30 
GeneralRe: type conversion Pin
ThatsAlok8-Aug-05 18:34
ThatsAlok8-Aug-05 18:34 
GeneralRe: type conversion Pin
Christian Graus8-Aug-05 19:07
protectorChristian Graus8-Aug-05 19:07 
GeneralRe: type conversion Pin
Jose Lamas Rios8-Aug-05 19:46
Jose Lamas Rios8-Aug-05 19:46 
HexEncoder doesn't provide a direct conversion to char* or CString. It only offers the possibility to output its content to an std::ostream. You could use an stringstream for that and then extract the string from it.

On the other hand, OCTETSTR is just a typedef for std::vector<unsigned char>, so you could iterate through each element and convert it to hexadecimal notation using sprintf like this:
// [UPDATE]
// void OctetStrToHexString(OCTETSTR str, CString& sResult)
void OctetStrToHexString(const OCTETSTR& v, CString& sResult)
{
   // [update] some minor errors corrected
   LPTSTR p = sResult.GetBuffer(v.size()*2);
   for (OCTETSTR::size_type i = 0; i < v.size(); i++)
      p += _stprintf(p, _T("%02X"), (int)v[i]);
   *p = _T('\0');
   sResult.ReleaseBuffer(v.size()*2);
}

Then your code could be written as follows:
   OCTETSTR str;
   CString sBuffer;
   OctetStrToHexString(str, sBuffer);
   poEdit->SetWindowText(sBuffer);

Note I haven't actually compiled nor tested the code shown above, so it may contain errors.

--
jlr
http://jlamas.blogspot.com/[^]
GeneralRe: type conversion Pin
Member 20725789-Aug-05 6:16
Member 20725789-Aug-05 6:16 
GeneralRe: type conversion Pin
Jose Lamas Rios9-Aug-05 6:48
Jose Lamas Rios9-Aug-05 6:48 
GeneralWeird Memory Issues Pin
LighthouseJ8-Aug-05 17:39
LighthouseJ8-Aug-05 17:39 
GeneralRe: Weird Memory Issues Pin
Christian Graus8-Aug-05 17:56
protectorChristian Graus8-Aug-05 17:56 
GeneralRe: Weird Memory Issues Pin
LighthouseJ9-Aug-05 4:19
LighthouseJ9-Aug-05 4:19 
GeneralRe: Weird Memory Issues Pin
Jose Lamas Rios8-Aug-05 18:25
Jose Lamas Rios8-Aug-05 18:25 
GeneralRe: Weird Memory Issues Pin
LighthouseJ9-Aug-05 4:27
LighthouseJ9-Aug-05 4:27 
GeneralRe: Weird Memory Issues Pin
Jose Lamas Rios9-Aug-05 4:49
Jose Lamas Rios9-Aug-05 4:49 
GeneralRe: Weird Memory Issues Pin
LighthouseJ9-Aug-05 4:54
LighthouseJ9-Aug-05 4:54 
GeneralRe: Weird Memory Issues Pin
John R. Shaw8-Aug-05 18:59
John R. Shaw8-Aug-05 18:59 
GeneralRe: Weird Memory Issues (solved this, another problem though) Pin
LighthouseJ9-Aug-05 4:55
LighthouseJ9-Aug-05 4:55 
GeneralRe: Weird Memory Issues (solved this, another problem though) Pin
Jose Lamas Rios9-Aug-05 5:31
Jose Lamas Rios9-Aug-05 5:31 
GeneralRe: Weird Memory Issues (solved this, another problem though) Pin
LighthouseJ9-Aug-05 10:28
LighthouseJ9-Aug-05 10:28 
GeneralFound What I Needed Pin
LighthouseJ9-Aug-05 13:59
LighthouseJ9-Aug-05 13:59 
GeneralRe: Weird Memory Issues (solved this, another problem though) Pin
John R. Shaw9-Aug-05 9:20
John R. Shaw9-Aug-05 9:20 
GeneralRe: Weird Memory Issues Pin
cmk9-Aug-05 1:03
cmk9-Aug-05 1:03 
GeneralRe: Weird Memory Issues Pin
LighthouseJ9-Aug-05 5:06
LighthouseJ9-Aug-05 5:06 

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.