• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

Question about char to ASCII code chars and display ,thanx!!!!!

Hi,In my programing ,I have a problem.I want to convert char to chars of ASCII code.For example ,I have 'A',I want convert 'A' to '41' and display '41' in my read_only
Edit Box,
Is there any API function to do so?
Would you please show me your tips?
Any advice is appreciated much!
1 Solution
Vinayak KumbarSr Program ManagerCommented:
Try this

void CMainFrame::OnMyaltr()
     char chTemp = 'A';
     CString str = GetCharsFromChar(chTemp);

CString CMainFrame::GetCharsFromChar(char chTemp)
     CString cStrs;
     cStrs.Format("%X", chTemp);
     return cStrs;

Here I am calling GetCharsFromChar(...) function from one of my message mapped function. Declare that function as

CString GetCharsFromChar(char chTemp);
and use it.

Try it out.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now