You are not logged in.

#1 2009-03-05 14:34:28

golfadas
Member
Registered: 2008-12-05
Posts: 22

[terminal something error]

Hi, something strange happened today i made a c program to print all the ascii characters but when i run it the terminal, the terminal gets all screwed up, even if i run it without x on  the console!!



this is a screen-shot of my desktop with the code and the terminal screwed up characters.

http://img145.imageshack.us/my.php?image=cenas.png


the code:

#include <stdio.h>
main(){
char n=127;
while (n){
n--;
printf("%c",n);
}
}

Last edited by golfadas (2009-03-05 14:37:40)

Offline

#2 2009-03-05 15:02:07

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: [terminal something error]

http://tldp.org/HOWTO/Text-Terminal-HOW … tml#ss17.9

In short: terminal input/output is pure magic (try reading the whole howto), but <enter>, 'reset', <enter> should fix it.


1000

Offline

#3 2009-03-05 15:08:15

krigun
Member
From: Norway
Registered: 2005-06-06
Posts: 122
Website

Re: [terminal something error]

You are trying to print the entire ASCII table. If you look at the ASCII table http://www.asciitable.com/, the lower range characters (less than 32) are not really printable characters, are they?

Offline

#4 2009-03-05 17:18:14

golfadas
Member
Registered: 2008-12-05
Posts: 22

Re: [terminal something error]

krigun wrote:

You are trying to print the entire ASCII table. If you look at the ASCII table http://www.asciitable.com/, the lower range characters (less than 32) are not really printable characters, are they?

no but that's not the problem, when the program returns the part:

bernardo@sonyarch

is written as something strange, its like the key map have changed.. if you look closely at the screenshot you can see the cursor after some weird characters.

if i try to write only numbers come out right everything else is pretty weird.

Offline

#5 2009-03-05 17:29:16

golfadas
Member
Registered: 2008-12-05
Posts: 22

Re: [terminal something error]

byte wrote:

http://tldp.org/HOWTO/Text-Terminal-HOW … tml#ss17.9

In short: terminal input/output is pure magic (try reading the whole howto), but <enter>, 'reset', <enter> should fix it.

its pretty easy to fix i just had to close the terminal and run it again, i just wanted to know what was going on... the symbols you are seeing correspond directly to chars..

Last edited by golfadas (2009-03-05 19:54:27)

Offline

Board footer

Powered by FluxBB