home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_06_07 / v6n7072a.txt < prev    next >
Text File  |  1989-09-28  |  941b  |  44 lines

  1. /* putchar() and puts() functions for device driver */
  2.  
  3. /*
  4.  
  5. SYNOPSIS
  6.  
  7.      putchar(c);
  8.      puts(s);
  9.  
  10.      int c;    character to be sent to screen
  11.      char *s;  string to be sent to screen
  12.  
  13. DESCRIPTION
  14.  
  15. These functions can be called by a device driver to send output to the screen
  16. through the ROM BIOS, instead of the standard output.  They act very much
  17. like their standard C counterparts, using \n as a line terminator.  However,
  18. puts() does not automatically put a \n at the end of the string.  CAUTION: Do
  19. not include stdio.h; that would cause the wrong version of putchar() to be
  20. compiled.
  21.  
  22. */
  23.  
  24. #include <dos.h>
  25.  
  26. void putchar(c) int c; {
  27. union REGS r;
  28. if (c=='\n') putchar('\r');
  29. r.h.ah = 14;
  30. r.h.al = c;
  31. r.x.bx = 0;
  32. int86(0x10, &r, &r);
  33. }
  34.  
  35. void puts(s) char *s; {
  36. while (*s) putchar(*s++);
  37.  
  38. /* 
  39. for complete compatibility with the standard C function,
  40. add the command putchar('\n');
  41. */
  42.  
  43. }
  44.