home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d4xx / d430 / smartfields.lha / SmartFields / Functions / con_put_line.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-01-11  |  889 b   |  31 lines

  1. /***************************************
  2. *  CONsole PUT LINE v1.11
  3. *  © Copyright Timm Martin
  4. *  All Rights Reserved
  5. ****************************************/
  6.  
  7. #include <exec/io.h>
  8. #include <exec/types.h>
  9. #include <console/functions.h>
  10.  
  11. void con_put_line( wreq, string, max )
  12.   struct IOStdReq *wreq;
  13.   UBYTE *string;
  14.   int   max;
  15. {
  16.   UBYTE c;       /* to store replaced character */
  17.   UBYTE *cp;     /* points to where string should end */
  18.   long  DoIO();  /* exec.library */
  19.  
  20.   cp  = string + max;        /* find where string should end */
  21.   c   = *cp;                 /* store character at that position */
  22.   *cp = '\0';                /* replace with NULL to guarantee end */
  23.  
  24.   wreq->io_Command = CMD_WRITE;
  25.   wreq->io_Data    = (APTR)string;
  26.   wreq->io_Length  = -1;     /* end when encounter NULL */
  27.   DoIO( wreq );
  28.  
  29.   *cp = c;                   /* replace NULL with character */
  30. }
  31.