Solved

number->ASCII byte

Posted on 1998-07-01
7
182 Views
Last Modified: 2013-11-20
I want to get the ASCII byte for the #15 and for #0, but I can't type 'em in.  How do I cast?
is it (char)15 and (char)0?
0
Comment
Question by:zorker
  • 4
  • 3
7 Comments
 
LVL 2

Accepted Solution

by:
kinkajou earned 20 total points
ID: 1318589
I'm not sure what you will get with your type cast as specified above.

Depending on what you need to do with the characters ASCII 15 and 0, you may not need to type cast.

Can you just assign the value like:
char string[1];
string[0] = 15;?
so that printf ("%s", string); prints a 0xD char that looks like a musical note.

Or are you asking to convert a number to a string like so:
char string[2];
string[0] = '1';
string[1] = '5';
so that printf ("%s", string); prints "15"
Which it might be better to use itoa();
0
 

Author Comment

by:zorker
ID: 1318590
I used ch=15 and got a little * like character.
The musical note was 14.
Did I do something wrong?
0
 
LVL 2

Expert Comment

by:kinkajou
ID: 1318591
Opps, my bad, you got the right character for 15!
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:zorker
ID: 1318592
I used ch=15 and got a little * like character.
The musical note was 14.
Did I do something wrong?
0
 

Author Comment

by:zorker
ID: 1318593
Thanks.
0
 
LVL 2

Expert Comment

by:kinkajou
ID: 1318594
Your welcome and Good Luck!
0
 

Author Comment

by:zorker
ID: 1318595
Thanks.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 100
Pressing cancel button with C# UI Automation 3 70
ORA-01403: no data found 43 101
iSeries DB2 Query 2 95
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: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

809 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