home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / MSDOS / WATTCP / UNZIPPED / MSWATTCP / ELIB / COUT.C next >
Encoding:
C/C++ Source or Header  |  1993-03-25  |  749 b   |  45 lines

  1. /***
  2.  * Filke: cout.c
  3.  *
  4.  * 16-Jun-92 lr
  5.  * various output functions used for debugging and error messages
  6.  ***/
  7.  
  8. #include <stdio.h>
  9. void outch( unsigned char ch )
  10. {
  11.     putchar(ch);
  12. }
  13.  
  14. void outs( unsigned char *s)
  15. {
  16.     puts(s);
  17. }       
  18.  
  19. void outsn( unsigned char *s,unsigned n)
  20. {
  21.     while (n--) outch(*s++);
  22. }
  23.  
  24. void outhex( unsigned char ch )
  25. {
  26.     unsigned char c;
  27.         
  28.     outch( (unsigned char) ((c=(unsigned char)(ch/16)) >9 ?
  29.                     c + 'A' - 10: c + '0'));
  30.     outch( (unsigned char) ((c=(ch%16)) >9 ? c + 'A' - 10: c + '0'));
  31. }
  32.  
  33. /*
  34.  * outhexes - dump n hex bytes to stdio
  35.  *
  36.  */
  37. void outhexes( unsigned char *p, unsigned n )
  38. {
  39.     while ( n-- > 0) {
  40.     outhex( *p++);
  41.     outch(' ');
  42.     }
  43. }
  44. /*** end of file cout.c ***/
  45.