Solved

number->ASCII byte

Posted on 1998-07-01
7
178 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
Comment Utility
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
Comment Utility
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
Comment Utility
Opps, my bad, you got the right character for 15!
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:zorker
Comment Utility
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
Comment Utility
Thanks.
0
 
LVL 2

Expert Comment

by:kinkajou
Comment Utility
Your welcome and Good Luck!
0
 

Author Comment

by:zorker
Comment Utility
Thanks.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to calculate times for developing software? 8 60
Replacement selected text 2 47
countEvens challenge 2 56
fizzArray  challenge 1 47
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 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

16 Experts available now in Live!

Get 1:1 Help Now