LinuxQuestions.org
Help answer threads with 0 replies.
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 02-09-2009, 02:46 PM   #1
rexStart
LQ Newbie
 
Registered: Sep 2008
Posts: 9

Rep: Reputation: 0
[QT4] QProcess and readin data from xterm


I sarts xterm from my program by using QProcess.
I need to send to xterm "tty" command and reads its output.
I try to do it a such way
Code:
	
        terminalProc.start("xterm");
	terminalProc.setReadChannel(QProcess::StandardOutput);
	
	terminalProc.waitForStarted(-1);
	terminalProc.write("tty\n");	
	QByteArray result = terminalProc.readAllStandardOutput();
But result is empty. What i am doing wrong?
Is there any other way to get value of tty?
 
Old 02-12-2009, 03:22 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Qt manual says this:
Quote:
QProcess more;
more.start("more");
more.write("Text to display");
more.closeWriteChannel();
// QProcess will emit readyRead() once "more" starts printing
It may be a good idea to wait for readReady(), because readAllStandardOutput() doesn't guarantee a wait until the data is available.
 
  


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
Problems running console commands using QProcess montylee Programming 4 09-27-2008 01:36 AM
Qt 4 QProcess help dimah Programming 1 05-05-2007 07:03 AM
Compiling qt4 apps for non-qt4 linux, win, mac birdseye Programming 4 10-31-2005 04:45 AM
readin memory stick trutnev Linux - Hardware 4 07-06-2005 08:40 PM
Opening an external application using Qprocess in QT designer nunation Programming 3 01-30-2005 02:39 AM

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

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