LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 07-07-2004, 03:13 AM   #1
Majestros
LQ Newbie
 
Registered: Jul 2004
Posts: 3

Rep: Reputation: 0
redirection data to stdin


Hi,
I need to send data read from a comm port (com1 for example) to the keyboard output buffer (stdin).

To do this can i simply use the file I/O function, fread and fwrite, specify stdin as stream to use? Or what?
Can anyone help me?

Tanks.
 
Old 07-07-2004, 04:56 AM   #2
pycoucou
Member
 
Registered: Apr 2004
Location: Edinburgh
Posts: 78

Rep: Reputation: 15
Hmm... Isn't it a bit weird? You want to redirect sth to stdin? I am not used to this kind of manipulation but would not it be more convenient to say that your port comm is stdin instead of faking it?
 
Old 07-07-2004, 09:20 AM   #3
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
open() up a descriptor to com port and then dup2() that descriptor to STDIN_FILENO.
 
  


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
gzlib: stdin: invalid compressed data -crc error pashford Linux - General 4 04-29-2008 07:21 AM
unbuffered stdin Mike Davies Linux - Software 1 03-03-2006 12:13 AM
stdout stdin Furlinastis Linux - Newbie 3 08-11-2005 11:00 PM
after redirecting stdin still need to read data from keyboard vrikers Programming 4 10-31-2004 06:11 AM
unbuffered stdin mvt Programming 7 05-17-2004 09:40 PM

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

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