Why does my program change the characters in my shell

Why does my program change the characters in my shell

Post by Andrew Falang » Fri, 27 Jun 2003 12:06:23



Hello,

I'd like to know what the typical reason for this is.  I'm debugging a
program I've written, and to make sure I'm using sscanf( ) and strcpy(
).  However, when it gets done puting the data on stdout, the program is
supposed to prompt me for action.

What is displayed is really weird text.  No English alphabetic
characters, just right angled shapes and stuff.  What normally alters
the character set of stdout (don't know if I worded that correctly)?

Andy

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----

 
 
 

Why does my program change the characters in my shell

Post by Lorinczy Zsigmon » Fri, 27 Jun 2003 13:46:02



> Hello,

> I'd like to know what the typical reason for this is.  I'm debugging a
> program I've written, and to make sure I'm using sscanf( ) and strcpy(
> ).  However, when it gets done puting the data on stdout, the program is
> supposed to prompt me for action.

> What is displayed is really weird text.  No English alphabetic
> characters, just right angled shapes and stuff.  What normally alters
> the character set of stdout (don't know if I worded that correctly)?

Your terminal is confused or switched into character-graphics mode...
try "reset" command
You can trace your program with "strace"

 
 
 

Why does my program change the characters in my shell

Post by agrawal » Fri, 27 Jun 2003 13:42:08


Hi Andy,
  I hope you must be ending each string with NULL characters otherwise
you will face this problem.
  It will be better if you just give part of the code and output.

Anand

Quote:> Hello,

> I'd like to know what the typical reason for this is.  I'm debugging a
> program I've written, and to make sure I'm using sscanf( ) and strcpy(
> ).  However, when it gets done puting the data on stdout, the program is
> supposed to prompt me for action.

> What is displayed is really weird text.  No English alphabetic
> characters, just right angled shapes and stuff.  What normally alters
> the character set of stdout (don't know if I worded that correctly)?

> Andy

> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----==  Over 80,000 Newsgroups - 16 Different Servers! =-----

 
 
 

Why does my program change the characters in my shell

Post by Andrew Gabri » Fri, 27 Jun 2003 17:28:23




Quote:> Hello,

> I'd like to know what the typical reason for this is.  I'm debugging a
> program I've written, and to make sure I'm using sscanf( ) and strcpy(
> ).  However, when it gets done puting the data on stdout, the program is
> supposed to prompt me for action.

> What is displayed is really weird text.  No English alphabetic
> characters, just right angled shapes and stuff.  What normally alters
> the character set of stdout (don't know if I worded that correctly)?

Run the program with the output sent to a file, and then read
the file with vi or cat -v (or pipe output through cat -v) and
you will likely see you are generating non-printing charaters.
You are probably hitting upon the sequence to put the terminal
into block graphics mode.

--
Andrew Gabriel
Consultant Software Engineer

 
 
 

Why does my program change the characters in my shell

Post by Stephane CHAZELA » Fri, 27 Jun 2003 19:44:27


[...]

Quote:> What is displayed is really weird text.  No English alphabetic
> characters, just right angled shapes and stuff.  What normally alters
> the character set of stdout (don't know if I worded that correctly)?

That's the alternate charset used for example to display frames
in a VT100 like terminal.

Issue

tput smacs
tput rmacs

to set/reset the alternet charset. (rmacs == reset mode alternet
charset)

--
Stphane

 
 
 

Why does my program change the characters in my shell

Post by Alex Siss » Sat, 28 Jun 2003 21:11:17




> > Hello,

> > I'd like to know what the typical reason for this is.  I'm debugging a
> > program I've written, and to make sure I'm using sscanf( ) and strcpy(
> > ).  However, when it gets done puting the data on stdout, the program is
> > supposed to prompt me for action.

> > What is displayed is really weird text.  No English alphabetic
> > characters, just right angled shapes and stuff.  What normally alters
> > the character set of stdout (don't know if I worded that correctly)?

> Your terminal is confused or switched into character-graphics mode...
> try "reset" command
> You can trace your program with "strace"

alternatively, you can play a fun game instead; cat /bin/ls and try
and ^C it before its finished cat'ing. sometimes if you're lucky, the
characters will be ok again.