home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / C / MBLIB10 / C_EXAMP / NETREAD.C < prev    next >
Text File  |  1993-03-07  |  1KB  |  37 lines

  1. /* Read netmail messages addressed to me, and print them. */
  2.  
  3. #include <stdio.h>
  4. #include <conio.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #include "mb_lib.h"
  8.  
  9. int putln (char *); /* proto */
  10.  
  11. void main () {
  12.   M_TEXT msgtxt;
  13.   NET_RECORD nethdr;
  14.   char msgpath [MAXPATH];
  15.   int msgnr;
  16.  
  17.   strcpy (msgpath, "C:\\MSGBASE");
  18.   clrscr ();
  19.   msgnr = net_first (msgpath);        /* Find netmail to me */
  20.   while (msgnr != -1) {
  21.     net_read_hdr (msgpath, msgnr, & nethdr);    /* Read header  */
  22.     msgtxt = net_read_text (msgpath, msgnr);    /* Read text    */
  23.     printf ("By: %s\n", nethdr.who_from);       /* Print header */
  24.     printf ("To: %s\n", nethdr.who_to);
  25.     printf ("Re: %s\n", nethdr.subject);
  26.     puts ("-----------------------------------------------");
  27.     txt_dump (msgtxt, putln, 70, 0);            /* Print text, using   */
  28.     puts ("<End of message>\n\n\n");            /* 70 cols, no kludges */
  29.     msgnr = net_next (msgpath, msgnr);
  30.   }
  31. }
  32.  
  33. int putln (char * line) {    /* This one does the actual printing */
  34.   puts (line);
  35.   return (0);
  36. }
  37.