Solved

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

Posted on 2002-04-14
1
194 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error on moodle after upgrade 3 149
sumHeights2  challenge 7 131
changeXy challenge 13 93
wordcount challenge 11 148
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.

730 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