Solved

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

Posted on 2002-04-14
1
197 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

688 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