Solved

number->ASCII byte

Posted on 1998-07-01
7
179 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
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.

 

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

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

Title # Comments Views Activity
iSeries FTP Exit Program 8 124
List out all word 7 261
NotAlone Challenge 20 80
Detect file exist or not 3 133
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…
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.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

861 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

26 Experts available now in Live!

Get 1:1 Help Now