LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-04-2004, 12:15 AM   #1
1337 Twinkie
Member
 
Registered: Jul 2004
Distribution: Fedora Core 2
Posts: 79

Rep: Reputation: 15
Question changing console text in-place


Ok, weird question. What I want to do is change a line in the console window (Linux or DOS) without re-printing it on a new line. Like the status bars ( |=== | )things in YUM, for example. So, does anyone know how to do this or where to go to get info/examples?

I would like to use Python, but I also know C++.
 
Old 08-04-2004, 03:16 AM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 243Reputation: 243Reputation: 243
On linux, you could use the ncurse library wich can control caracter position in a terminal.
 
Old 08-04-2004, 10:26 AM   #3
1337 Twinkie
Member
 
Registered: Jul 2004
Distribution: Fedora Core 2
Posts: 79

Original Poster
Rep: Reputation: 15
not compiling

Ok, I did a helloworld program with ncurses. Problem is that it won't compile. G++ gives "undefined reference to: xxx()" where xxx() is any ncurses function. I found this strange because the ncurses.h header is right there in my '/usr/include' directory. Here is the program:

Code:
#include <ncurses.h>

int main()
{	
	initscr();			/* Start curses mode */
	printw("Hello World !!!");	/* Print Hello World*/
	refresh();			/* Print it on to the real screen */
	getch();			/* Wait for user input */
	endwin();			/* End curses mode*/

	return 0;
}
and here are the errors (from G++):

Quote:
/tmp/ccJvUTS2.o(.text+0x11): In function `main':
: undefined reference to `initscr'
/tmp/ccJvUTS2.o(.text+0x1e): In function `main':
: undefined reference to `printw'
/tmp/ccJvUTS2.o(.text+0x26): In function `main':
: undefined reference to `refresh'
/tmp/ccJvUTS2.o(.text+0x2f): In function `main':
: undefined reference to `stdscr'
/tmp/ccJvUTS2.o(.text+0x34): In function `main':
: undefined reference to `wgetch'
/tmp/ccJvUTS2.o(.text+0x3c): In function `main':
: undefined reference to `endwin'
So, what gives? The program is copied line for line from this place: http://en.tldp.org/HOWTO/NCURSES-Pro...lloworld.html, so I believe it should work.

[edit[
Ok, I looked at the errors again and the problem seems to go al llittle deaper than I thought. Why is this: '/tmp/ccJvUTS2.o(.text+0x1e): ' there? That's just weird.
[/edit]

Last edited by 1337 Twinkie; 08-04-2004 at 10:49 AM.
 
Old 08-04-2004, 10:48 AM   #4
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
Add -lcurses to your compile command.
 
Old 08-04-2004, 10:51 AM   #5
1337 Twinkie
Member
 
Registered: Jul 2004
Distribution: Fedora Core 2
Posts: 79

Original Poster
Rep: Reputation: 15
Cool! Thanks, that worked. ^_^
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Only TEXT console (SUSE 9.3) Hairulfr Linux - Newbie 1 08-21-2005 09:34 PM
How do I see all text in console? fannymites Linux - General 2 04-15-2005 06:01 PM
Console text gamehack Slackware 6 09-25-2004 04:00 AM
changing screen resolution for text (shell) console Repeater Linux - Newbie 13 08-30-2004 09:30 AM
how can I seprate normal text from html tags spell check it & then again place it ins amit_28oct Programming 5 08-07-2004 07:09 AM

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

All times are GMT -5. The time now is 08:35 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration