LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-05-2003, 07:42 AM   #1
dummyagain
Member
 
Registered: Sep 2003
Posts: 74

Rep: Reputation: 15
Unhappy text mode VS X window


is there any command for testing if the program is rumming in text mode console or X window??
 
Old 10-05-2003, 08:17 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
You could examine the parent process IDs they should lead to a shel whose parent will either be a console or an x application.
 
Old 10-05-2003, 08:41 AM   #3
dummyagain
Member
 
Registered: Sep 2003
Posts: 74

Original Poster
Rep: Reputation: 15
can u give me some example like a program ?
 
Old 10-05-2003, 08:42 AM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
You could use "ttyname()". This returns the path to the terminal connected to a filedescriptor. For consoles, this will be something like "/dev/tty1", for a xterm it will return somthing like /dev/pts/1
 
Old 10-05-2003, 08:43 AM   #5
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Quote:
Originally posted by dummyagain
can u give me some example like a program ?
Just use ps.
 
Old 10-06-2003, 11:45 AM   #6
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
...or the "tty" command.
 
  


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 change text color using linux in text mode only runlevel 3? Xavius Linux - General 7 05-07-2009 02:19 AM
Change from GUI mode to text mode alexr186 Linux - Software 4 01-08-2009 06:56 AM
Change the display mode in text mode Drunkalot Linux - General 7 08-12-2005 11:35 AM
How to; Suse9.3 prof. text mode to graphical mode anjum Linux - Software 5 07-20-2005 11:36 PM
Booting in text mode versus graphics mode LChalupa Linux - Newbie 3 01-15-2005 07:53 PM

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

All times are GMT -5. The time now is 03:05 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