Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I'm so glad I found this site... Now I can get some sleep, because my problem is solved..."

Geography

Where in the world do Tek-Tips members come from?

Communication with com ports...

anaphaxeton (Programmer)
3 Jun 99 10:50
This may seem like a silly question but...
How does one go about redirecting output
and getting input from a com port device?
A modem for example. Any help with this
would be great.
capchap (MIS)
16 Jun 99 17:19
I am currently working on a similar issue but have solved it in part.

The answer depends upon where ("c" or "C-script" you want to do the re-direct) since you say it's a silly question, I'm not sure which you want to do.

I will give you the benefit of the doubt and assume you want to do it in a "c" compiled program.

Disclaimer: I received what I'm going to show you as a fax from IBM. so for legal purposes I want to give them credit. If you want the entire program, along with the entire legal disclaimer, contact IBM for the full program...It is called 'motalk.c'

at any rate, here is an excerpt that give the idea. Be aware that there is a bunch of 'setup' stuff required. The whole program is about 150 -200 lines of code. If you send me your E-mail address I can send you a copy of the entire program.


while(1)
{

if(select(rfd, &afds, &afds, (fd_set *)0, (struct timeval *)0) < 0)
printf("Select failed - errno = %d\n", errno);

if(FD_ISSET(rfd, &afds))
while ((num = read(rfd, buffer, 4096)) > 0)
write(fileno(stdout), buffer, num);

if(FD_ISSET(std, &afds))
while ((num = read(fileno(stdin), buffer, 4096)) > 0)
write(fileno(fdw), buffer, num);

}

Now, for a question of my own...... How do you convince X-modem to accept input from somewhere other that stdin/stdout? Or, stated differently, how do I spawn a process whose stdin/stdout is already /dev/tty?

Also, if you could tell me how to 'post' inquiries myself, I would appreciate it.

des :)

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close