Solved

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

Posted on 2002-04-14
1
193 Views
Last Modified: 2013-11-20
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!
0
Comment
Question by:vincent_lea
1 Comment
 
LVL 8

Accepted Solution

by:
VinExpert earned 66 total points
ID: 6941034
Hi,
Try this

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

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.
VinExpert
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now