Message-ID: <5337D585DDD3D111996B0008C728F07DCE468D@pa00fsr01.pa.atitech.com> From: Nick DiToro To: djgpp AT delorie DOT com Subject: tip Date: Tue, 14 Nov 2000 18:17:36 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C04E91.174AC758" Reply-To: djgpp AT delorie DOT com This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C04E91.174AC758 Content-Type: text/plain; charset="iso-8859-1" Hi, I need a real simple com port redirection program like *nix tip. Included is something I hacked together. If I use djgpp it appears to actually open a file called com2. If I compile using watcom for a 16 bit executable, I am able to get about a line of output. Then I get an error from dos saying General error reading device COM2 Abort retry fail?. This has been done a million times before, I am sure. I can not find the source for tip. Any ideas? Thanks in advance, Nick #include #include #include int main(void) { int c; FILE* com =fopen("com2","r+"); system ("mode com2 9600 none 8 1"); fprintf(com, "h\n"); // do "h" command to external computer so we can see output c=fgetc(com); while(EOF != c) { if (0!=c) printf("%c",c); c=fgetc(com); } fclose(com); return 0; } ------_=_NextPart_001_01C04E91.174AC758 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable tip

Hi,

I need = a real simple com port redirection program like *nix tip.  Included is = something I hacked together. 

If I = use djgpp it appears to actually open a file called com2.

If I = compile using watcom for a 16 bit executable, I am able to get about a line of output.  = Then I get an error from dos saying General error reading device = COM2 Abort retry = fail?.

This = has been done a million times before, I am sure.  I can not find = the source for tip.  Any ideas?

Thanks = in advance,

Nick


#include <stdio.h>

#include <stdlib.h>

#include <conio.h>

int = main(void)

{

    int c;

    FILE* com = =3Dfopen("com2","r+");

    system ("mode com2 9600 none 8 = 1");

    fprintf(com, = "h\n");  // do "h" command to external computer so we can = see output

    c=3Dfgetc(com);

    while(EOF !=3D c)

    {

        if = (0!=3Dc)

         &nb= sp;  printf("%c",c);

        = c=3Dfgetc(com);

    }

    fclose(com);

    return 0;

}

------_=_NextPart_001_01C04E91.174AC758--