LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 12-29-2011, 04:10 PM   #1
peter576
LQ Newbie
 
Registered: Nov 2009
Distribution: Slackware
Posts: 25

Rep: Reputation: 0
How can I send keystrokes to a terminal program?


Exactly, I'd like to make an ftp connection using the ftp program which can by launch by typing ftp into the terminal. I can write a code in C++ which will connect to the ftp server, but afterwards I should send me keystrokes to the ftp program, not to the terminal itself, if I write system("peter") for example (that's my username) the terminal will write: no such command, after ftp quitted. So I guess I can't use the system function to solve this problem.

Are there any solution to this?
 
Old 12-29-2011, 07:05 PM   #2
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,164

Rep: Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506Reputation: 506
expect does exactly that: it spawns a process, and connect stdin and stdout to your terminal.

http://www.tcl.tk/man/expect5.31/

jlinkels
 
Old 12-30-2011, 05:13 AM   #3
peter576
LQ Newbie
 
Registered: Nov 2009
Distribution: Slackware
Posts: 25

Original Poster
Rep: Reputation: 0
thank you
 
  


Reply

Tags
c++, keys, terminal


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
How to send keystrokes in Ubuntu? QueenZ Linux - Newbie 1 08-28-2011 10:23 AM
[SOLVED] bash how to send keystrokes via fifo to mpg123 in background porphyry5 Programming 6 07-17-2011 01:02 PM
Centos 5.6, Gnome terminal, Xmodmap: remap multiple keystrokes? needsleep Linux - Newbie 4 06-09-2011 08:02 AM
Send keystrokes in console mode Reginald0 Linux - General 2 08-27-2003 07:46 AM
Second Terminal Keystrokes Guinney Linux - Newbie 2 11-29-2002 08:18 PM


All times are GMT -5. The time now is 12:00 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration