[comp.lang.c] Question: Turbo C and communication

mccaugh@s.cs.uiuc.edu (08/25/89)

Responding to: thomas@mvac23.UUCP  re: Turbo-C and comm

>However, when the program exits, it lowers DTR as part of it's cleanup (I'm 
>talking previously hacking in BASIC).  This is no good, since the dial command 
>goes out and before anything happens, DTR goes low killing the modem.

>Background:  I am using a terminal emulator which operates in block mode.
>However the modem can't handle a string which ends in an XOFF rather than 
>a carriage return.  So.... I though I would write a 'dialer' program which
>would dial the modem, then exit and start the emulation program so that it
>is ready by the time the modem connects.  So while going from the dialer
>program to the emulator, DTR has to stay high (so that the modem doesn't 
>hang up).

> The question:  Can I do this with Turbo C?  Do I have control over those
> bits in the 'modem port' of the PC?

 The answer is definitely yes, you can do this in Turbo-C, but first, what
 confuses me is that you say: "I thought I would write a 'dialer' program
 which would ... then exit and start the (terminal) emulation program...";
 then later on: "so while going from the dialer ..., DTR has to stay high",
 but initially, you reported: "when the program exits, it lowers DTR". It
 sounds like your own 'dialer' program is lowering the DTR upon exit to the
 emulator...what are you doing to make this happen?

thomas@mvac23.UUCP (Thomas Lapp) (08/31/89)

> Nf-From: s.cs.uiuc.edu!mccaugh    Aug 25 02:17:00 1989
> Responding to: thomas@mvac23.UUCP  re: Turbo-C and comm

> >However, when the program exits, it lowers DTR as part of it's cleanup (I'm 
> >talking previously hacking in BASIC).  This is no good, since the dial command 
> >goes out and before anything happens, DTR goes low killing the modem.
> 
> >Background:  I am using a terminal emulator which operates in block mode.
> >However the modem can't handle a string which ends in an XOFF rather than 
> >a carriage return.  So.... I though I would write a 'dialer' program which
> >would dial the modem, then exit and start the emulation program so that it
> >is ready by the time the modem connects.  So while going from the dialer
> >program to the emulator, DTR has to stay high (so that the modem doesn't 
> >hang up).
> 
> > The question:  Can I do this with Turbo C?  Do I have control over those
> > bits in the 'modem port' of the PC?
> 
>  The answer is definitely yes, you can do this in Turbo-C, but first, what
>  confuses me is that you say: "I thought I would write a 'dialer' program
>  which would ... then exit and start the (terminal) emulation program...";
>  then later on: "so while going from the dialer ..., DTR has to stay high",
>  but initially, you reported: "when the program exits, it lowers DTR". It
>  sounds like your own 'dialer' program is lowering the DTR upon exit to the
>  emulator...what are you doing to make this happen?

Sorry for the confusion.  The program which lowers DTR when it exits is the
BASIC hack I put together.  The BASIC interpreter lowers DTR when it exits
to the system.  

My interest is to try the same thing in Turbo C with the hope that I could
leave DTR high when I exited back to the Operating system.  So the (not-yet-
written) C program would raise DTR, send dial command to the modem, and 
exit.  In a batch 'shell' I call the Turbo-C 'dialer' program, then 
immediately call the terminal emulater so that it is in place before the
remote modem answers :-).

From what I've been hearing, I think it can be done.  But since I am new
at C programming, I think this may not be an exercise for the novice
student.  Maybe I'll try something simpler first and work up to it :-)
                         - tom

internet: mvac23!thomas@udel.edu  or  thomas%mvac23@udel.edu
uucp    : {ucbvax,mcvax,psuvax1,uunet}!udel!mvac23!thomas
Location: Newark, DE, USA                          
Quote   : NOTICE: System will have a scheduled disk crash at 4:45pm today.