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

  1. /*--------------------------------------*/
  2. /*                    */
  3. /*             LONG2ASC(X,X)        */
  4. /*                    */
  5. /* Puts a long integer given in the    */
  6. /* first argument into a character    */
  7. /* array given in the second argument.    */
  8. /*                    */
  9. /*--------------------------------------*/
  10. void long2asc(a,r)
  11. char r[4];
  12. long a;
  13. {
  14.     int c;
  15.     long d,e;
  16.     c=e=a/16777216L;
  17.     d=a-16777216L*e;
  18.     r[0]=c;
  19.     c=d=a/65536L;
  20.     d=a-65536L*d;
  21.     r[1]=c;
  22.         c=e=d/256;
  23.     r[2]=c;
  24.         c=d=d-256*e;
  25.         r[3]=c;
  26. }