LinuxQuestions.org
Visit Jeremy's Blog.
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-23-2012, 10:04 AM   #1
hemanth grewshan
LQ Newbie
 
Registered: Aug 2012
Posts: 1

Rep: Reputation: Disabled
Question How to use linux terminal in c++?


how to use linux terminal in c++ please [REMOVED] kindly..........

Last edited by unSpawn; 08-23-2012 at 11:33 AM. Reason: //Remove email req prior to move
 
Old 08-23-2012, 11:46 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,479

Rep: Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060
What do you mean by 'using linux terminal'?
 
Old 08-23-2012, 12:11 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by hemanth grewshan View Post
how to use linux terminal in c++ please [REMOVED] kindly..........
You can use it to run a text editor to write programs.
You can use it to display the output of a program. Example: write the standard "Hello World" program. Unless you change it, the output goe to "standard output", which is the terminal.
You can use it to keep your files organized.
 
1 members found this post helpful.
Old 08-26-2012, 10:04 AM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Do you understand the concept of standard IO: stdin, stdout, stderr, etc.? Any process you launch from a 'terminal', normally by invoking it from a shell, will use the terminal as its standard input, standard output, and standard error streams, unless the shell has been used to redirect one or more of those to somewhere else. When you use printf(), scanf(), or most of the functions declared in stdio.h, they will read or write from/to the terminal, assuming no redirection has been performed.
The terminal has a few properties that other files and devices do not have. It understands sequences of special characters commonly called escape-sequences, that you may embed in your stdout and stderr stream. When properly crafted, these are trapped by the terminal and interpreted by the terminal as commands to the terminal. The commands are typically used to position the cursor in some way, or otherwise affect the behavior of the terminal itself, such as invoking special text effects, clearing the screen, etc. There are many types of terminals, originating from Unix/Linux's use of dumb terminals produced by many different manufacturers. They all have their own way of using their own escape sequences, so it is important to match the terminal type to the strings of escape sequences you want to use. There is a somewhat complex system of configuration files that tries to simplify this, and there is also the curses API and the curses or ncurses library that implements that API. The library allows you to write code that manipulates the terminal in a consistent way, without having to know the details of the terminal in use. It is how console-mode programs create windows, menus, etc. Most Linux installers (software) use this if they are run in text-mode. There are several popular text-mode applications that make heavy use of the curses API, such as the mc (midnight commander) filesystem browser.
You can also use a terminal as a place to put your pizza box, but this can be done in any language, not just C++.
--- rod.

Last edited by theNbomr; 08-26-2012 at 10:06 AM.
 
Old 08-26-2012, 10:13 AM   #5
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,569

Rep: Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129Reputation: 2129
Quote:
Originally Posted by pixellany View Post
You can use it to run a text editor to write programs.
You can use it to display the output of a program. Example: write the standard "Hello World" program. Unless you change it, the output goe to "standard output", which is the terminal.
You can use it to keep your files organized.
You can also call system commands (as if you ran them in the terminal) from within the program using system().
 
  


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
[SOLVED] Make linux terminal transparent with terminal command? yooy Linux - Newbie 1 05-11-2010 03:24 AM
Ubuntu terminal look like linux mint terminal? caa1980 Ubuntu 6 08-13-2009 12:16 PM
LXer: The Terminal Test: Do you have to use the terminal in Linux? LXer Syndicated Linux News 0 01-01-2009 06:50 PM
Difference between a Shell terminal window and the KDE Linux Console terminal window? bostonantifan Fedora 2 03-25-2007 07:23 PM
TightVNC Ver terminal Services.. also looking for terminal Services for linux 2782d4 Linux - Security 3 05-20-2004 02:30 AM

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

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