LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-18-2006, 07:28 PM   #1
Four
Member
 
Registered: Aug 2005
Posts: 298

Rep: Reputation: 30
Terminal escape sequenses


I was reading about how to change the text color in console programaticly and I was introduced to terminal escape sequences. One thing I read is that it is not portable. How portable is it? I heard ncurses is more portable.

My porpose is to design programs that should be runnable on unix machine ( which works and I'm happy) for the future when I come back to escape sequences and changing color of console I would like to know how portable is it for me to decide how much effort I'll put in to learn ncurses.

Thank you
 
Old 10-18-2006, 07:55 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by Four
I was reading about how to change the text color in console programaticly and I was introduced to terminal escape sequences. One thing I read is that it is not portable. How portable is it? I heard ncurses is more portable.
I would go as far as to say that ANSI/VT100 are solid standards, and would be more portable than the BSD curses (with which I think ncurses is backwards-compatible) standard (if you want to call it a standard). For example, on a stripped-down, lean, headless, embedded computer I would not expect to have (n)curses installed. But if I pull out my Serial Console/VT100 Emulator, I get colors (since the actual bytes are meant to be interpreted by the console and the computer (kernel) itself knows nothing about the colors).

Curses, however, is included with almost any modern unix on which you might possibly find it useful. Curses definitely wins the maintenance and readability contest. It might be easier to use once you get used to it (and might be easier to port when/if you decide that in addition to just colors, you want your program to take key-based input or use console-style dialogs, etc).
 
Old 10-19-2006, 04:26 AM   #3
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
google, vt100 escape


google is your friend
 
Old 10-19-2006, 04:37 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
it's non-portable but it tends to work ok on all terminals even DOS.
in my experience.

note in linux there is an escape to change the beep length and freq.
quite interesting!
 
Old 10-19-2006, 09:13 PM   #5
Four
Member
 
Registered: Aug 2005
Posts: 298

Original Poster
Rep: Reputation: 30
Interesting it works on dos. Does it work on dos (or the dos-like window [cmd]) on windows xp?
 
Old 10-20-2006, 03:32 AM   #6
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
actually, i confess, i haven't tried lately!
it is from memory.
(who am i?)
 
Old 10-20-2006, 03:53 AM   #7
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
yes, in DOS I remember now.
I used to do it with C programs.

you need to load the ANSI.SYS driver.
I'm talking years ago windows 3.1 when I was young
and used microsoft products

(wipes away a misty tear)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i escape a / ??? Fascistchicken Linux - General 10 09-12-2004 11:28 AM
How to stop terminal escape sequences ? Mike Davies Linux - Newbie 1 08-08-2004 11:37 AM
Escape! Wind0wR3fuge Linux - Newbie 6 07-11-2004 03:00 AM
escape sequence help in C name_in_use450 Linux - General 6 07-01-2004 09:23 AM
The Great Escape Treefrog Linux - Software 6 11-11-2003 06:56 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration