Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use symbols of extended ASCII table in C?

I've been tried to print Extended ASCII characters:

http://www.theasciicode.com.ar/

But all those symbols were printed as question-character on the white background ?.

I use the following cycle to print that symbols:

for (i = 0; i <= 30; i++)
    printf("%c", 201); 

Question: Is there any way to print those Extended ASCII characters or not? Or maybe there is special library for these characters?


OS Linux Ubuntu 13.04, Code::Blocks 12.11 IDE.

like image 371
yulian Avatar asked Jun 28 '13 10:06

yulian


People also ask

How do I display extended ASCII characters?

On a standard 101 keyboard, special extended ASCII characters such as é or ß can be typed by holding the ALT key and typing the corresponding 4 digit ASCII code. For example é is typed by holding the ALT key and typing 0233 on the keypad.

How do I use ASCII characters?

To insert an ASCII character, press and hold down ALT while typing the character code. For example, to insert the degree (º) symbol, press and hold down ALT while typing 0176 on the numeric keypad. You must use the numeric keypad to type the numbers, and not the keyboard.

What is the extended ASCII character set?

A set of codes that extends the basic ASCII set. The basic ASCII set uses 7 bits for each character, giving it a total of 128 unique symbols. The extended ASCII character set uses 8 bits, which gives it an additional 128 characters.

Where is extended ASCII is a ____ bit code?

Extended ASCII, as the eight-bit code is known, was introduced by IBM in 1981 for use in its first PC, and it soon became the industry standard for personal computers. In extended ASCII, 32 code combinations are used for machine and control commands, such as…


1 Answers

It's better to use unicode than extended ASCII, which is non-standard. A thread about printing unicode characters in C : printing-utf-8-strings-with-printf-wide-vs-multibyte-string-literals

But indeed you need to copy paste unicode characters..

A better way to start:

#include <stdio.h>

int main() {
    printf("\u2500\u2501\n");
}

See https://en.wikipedia.org/wiki/Box-drawing_character#Unicode for unicode characters for this extended ASCII style box art..

like image 104
Pieter van der Meer Avatar answered Sep 30 '22 21:09

Pieter van der Meer