delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/04/07:50:27

Date: Thu, 4 Nov 1999 13:18:05 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Surahyo <surahyo AT pgrad DOT unimelb DOT edu DOT au>
cc: djgpp AT delorie DOT com
Subject: Re: Need help
In-Reply-To: <4.1.19991104211819.00a243a0@mail.student.unimelb.edu.au>
Message-ID: <Pine.SUN.3.91.991104130944.11010B-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, 4 Nov 1999, Surahyo wrote:

> Could you please send me any simple program
> to send and receive data using RS-232 (DOS, PC).

The following is UNTESTED:

  int main (void)
  {
    static char message[] = "$PASHQ,GGA";
    char buf[80];
    int c;

    /* Send the string to COM1.  */
    fwrite (message, 1, sizeof(message),  stdaux);

    /* Read the first character of the response.  */
    c = getc (stdaux);

    /* Read 10 characters.  */
    fread (buf, 1, 10, stdaux);

    return 0;
  }

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019