By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,726 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

How to print unusual characters

P: 31
While programming a mini-shell for linux, I wanted to use an original PROMPT, and I remembered that there did exist two smileys in ASCII code.

I couldn't use it since these characters are 001(SOH) and 002(STX).

I tried to find these characters written anywhere (you know... traditional copy/paste method), but again failed.

then I thought about ''.

I have this

Expand|Select|Wrap|Line Numbers
  1. #declare PROMPT 62 // '>'
I needed to know the decimal of , so I wrote

Expand|Select|Wrap|Line Numbers
  1. printf("%d",'')
tryng to discover it, and I got 14844588 which is not any character.

A black rhombus (i think that means unknown character) is shown if I want to print that char.

How can I write this kind of characters?
Jun 17 '07 #1
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,197
char values like 1 and 2 have no printable glyph. You would write code to detect 1 and print STX.

Be careful. 001 in C/C++ is octal. So, 010 is an 8 where as 10 is 10.

You can read and write these values freely to an from disc since char is just an 8-bit integer.
Jun 18 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.