home *** CD-ROM | disk | FTP | other *** search
- /*================================================*/
- /* TVWNREAD.C */
- /* */
- /* (c) Copyright 1988 Ralf Brown */
- /* All Rights Reserved */
- /* May be freely copied for noncommercial use as */
- /* long as this copyright notice is kept intact */
- /* and any changes are indicated in the comment */
- /* blocks for the functions */
- /*================================================*/
-
- #include <stdio.h>
- #include "tvapi.h"
-
- /*================================================*/
- /* TVwin_nread read next N chars from window */
- /* Ralf Brown 4/3/88 */
- /*================================================*/
-
- int pascal TVwin_nread(OBJECT win,void *buffer,int n)
- {
- PARMLIST3 p ; /* returns width-of-screen/addr/count */
- register int count ;
-
- if (buffer == NULL)
- return 0 ;
- p.num_args = 1 ;
- n-- ; /* reserve space for null to terminate string */
- p.arg[0] = (DWORD) n ;
- TVsendmsg(READ_MSG, win?TOS:ME, win, (PARMLIST *)&p) ;
- count = (int) p.arg[0] ;
- if (count > n)
- count = n ;
- while (count--)
- *((char *)buffer)++ = *((char far *)p.arg[1])++ ;
- *((char *)buffer) = '\0' ;
- return (int) p.arg[0] ;
- }
-
- /* End of TVWNREAD.C */
-