LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-09-2013, 07:30 PM   #1
embeddedPROJECTS
LQ Newbie
 
Registered: Aug 2012
Location: Modena - Italy
Posts: 12

Rep: Reputation: Disabled
C++ how to get a string parameter from another program with '|' or < in bash


I wrote a program that writes data on an lcd display of my Raspberry pi, but it only gets data typed on the terminal, if i write 'uname -r | lcd_message' it doesnt write anything.

I used the standard code:

int main(int argc, char *argv[])....and so on.
 
Old 11-10-2013, 01:00 PM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
You'll want to look up "C stdin" or "C++ stdin". From the bash man page when you're using a pipe you're redirecting stdout of one program to stdin of another. In a program the three most common file descriptors are stdout (file descriptor 1), stdin (file descriptor 0), and stderr (file descriptor 2). However, a program can have up to 9 file descriptors to manipulate input and output.

See Redirection in bash for a more thorough description about that topic.

Last edited by sag47; 11-10-2013 at 01:02 PM.
 
1 members found this post helpful.
Old 11-10-2013, 04:44 PM   #3
embeddedPROJECTS
LQ Newbie
 
Registered: Aug 2012
Location: Modena - Italy
Posts: 12

Original Poster
Rep: Reputation: Disabled
Cool, thanks sag47, now i know where to look.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Parse string tokens and pass remaining as parameter yaplej Programming 7 07-12-2013 12:55 PM
What happened when passing a static string to a std::string& parameter? fantasy1215 Programming 7 11-30-2012 07:34 AM
bash: substitute parameter in a quoted string, stored in another variable GamerX Linux - General 5 01-31-2010 08:48 PM
Bash variable problem: cURL -b parameter (string form e.g. "name=value;n2=v2") sithemac Other *NIX 3 07-09-2008 06:15 PM
linux bash - how to use a dynamic parameter in shell parameter expansion expression nickleus Linux - General 2 08-21-2006 04:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:21 PM.

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