home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 1 / FishNMoreVol1.bin / more / code_examples / librar / slhex2fi.c < prev    next >
Text File  |  1989-02-08  |  611b  |  29 lines

  1. /*--------------------------------------*/
  2. /*                    */
  3. /*           SLHEX2FILE(X,X)        */
  4. /*                    */
  5. /* Writes a number to a file in hex for-*/
  6. /* mat. The first argument is the file    */
  7. /* descriptor and the second is the     */
  8. /* number to write.            */
  9. /*                    */
  10. /*--------------------------------------*/
  11. # include "stdio.h"
  12. void slhex2file(fd,a)
  13. long a;
  14. FILE *fd;
  15. {
  16.         long d,e;
  17.     int c;
  18.     c=e=a/16777216L;
  19.     d=a-16777216L*e;
  20.     putc(scram(c),fd);
  21.     c=d=a/65536L;
  22.     d=a-65536L*d;
  23.     putc(scram(c),fd);
  24.         c=e=d/256;
  25.     putc(scram(c),fd);
  26.         c=d=d-256*e;
  27.         putc(scram(c),fd);
  28. }
  29.