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

  1. /* Write a new netmail message. */
  2.  
  3. #include "mb_lib.h"
  4. #include <string.h>
  5. #include <stdio.h>
  6.  
  7. M_TEXT txt;                          /* Text handle    */
  8. NET_RECORD hdr;                      /* Netmail header */
  9.  
  10. #define NMPATH "C:\\MSGBASE"         /* Let's be lazy and do it this way */
  11.  
  12. main () {
  13.   txt = txt_new ("This is a netmail message. ");   /* First, create text */
  14.   txt_add (txt, "As you can see, writing one is quite easy.\r\r");
  15.   txt_add (txt, "Bye!\r");
  16.   net_hdr_clear (& hdr);
  17.   strcpy (hdr.who_from, "Frank Van.wensveen");    /* Then, build a header */
  18.   strcpy (hdr.who_to, "SysOp");
  19.   strcpy (hdr.subject, "Demo");
  20.   hdr.dest_node = 703;             /* From 2:285/504.1 to 27:1331/703.2 */
  21.   hdr.orig_node = 504;
  22.   hdr.orig_net = 285;
  23.   hdr.dest_net = 1331;
  24.   hdr.dest_zone = 27;
  25.   hdr.orig_zone = 2;
  26.   hdr.dest_point = 2;
  27.   hdr.orig_point = 1;
  28.   hdr.attribute = NM_LOCAL | NM_KILL;
  29.   net_fixup4d (& hdr, txt);            /* Create INTL and FMPT/TOPT kludge */
  30.   if (net_write (NMPATH, net_last (NMPATH) + 1, & hdr, txt))   /* Write it */
  31.     printf ("Error %d writing netmail:\n%s\n", errortype, errorstring);
  32.   return (0);
  33. }