Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 12-29-2011, 05:10 PM   #1
Registered: Nov 2009
Distribution: Debian 8 (64bit)
Posts: 31

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, 08:05 PM   #2
Senior Member
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,487

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

Old 12-30-2011, 06:13 AM   #3
Registered: Nov 2009
Distribution: Debian 8 (64bit)
Posts: 31

Original Poster
Rep: Reputation: 0
thank you


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

All times are GMT -5. The time now is 04:29 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration