hexoffset.c.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?xml version='1.0' encoding='iso-8859-1'?>
  2. <!doctype html public '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
  3. <html xmlns='http://www.w3c.org/1999/xhtml' lang='en-us'>
  4. <head>
  5. <title>
  6. hexoffset.c
  7. </title>
  8. <meta http-equiv='content-type' content='text/html;iso-8859-1'/>
  9. <meta name='generator' content='motley-tools 1.9.4 13:40:33 Feb 18 2015'/>
  10. <meta name='author' content='cmaier@cmassoc.net'/>
  11. <meta name='robots' content='noindex,nofollow'/>
  12. <link href='toolkit.css' rel='stylesheet' type='text/css'/>
  13. </head>
  14. <body>
  15. <div class='headerlink'>
  16. [<a href='hexload.c.html' title=' hexload.c '>PREV</a>]
  17. [<a href='toolkit.html' title=' Index '>HOME</a>]
  18. [<a href='hexout.c.html' title=' hexout.c '>NEXT</a>]
  19. </div>
  20. <pre>
  21. /*====================================================================*
  22. *
  23. * char * hexoffset (char buffer [], size_t length, off_t offset);
  24. *
  25. * memory.h
  26. *
  27. * encode buffer with with a NUL terminated string containing the
  28. * hexadecimal representation of a memory offset; the result will
  29. * be padded with leading zeros;
  30. *
  31. * Motley Tools by Charles Maier &lt;cmaier@cmassoc.net&gt;;
  32. * Copyright (c) 2001-2006 by Charles Maier Associates;
  33. * Licensed under the Internet Software Consortium License;
  34. *
  35. *--------------------------------------------------------------------*/
  36. #ifndef HEXOFFSET_SOURCE
  37. #define HEXOFFSET_SOURCE
  38. #include &lt;memory.h&gt;
  39. #include &quot;../tools/number.h&quot;
  40. #include &quot;../tools/memory.h&quot;
  41. char * hexoffset (char buffer [], size_t length, off_t offset)
  42. {
  43. char * string = buffer + length - 1;
  44. memset (buffer, 0, length);
  45. while (string &gt; buffer)
  46. {
  47. *--string = DIGITS_HEX [offset &amp; 0x0F];
  48. offset &gt;&gt;= 4;
  49. }
  50. return (buffer);
  51. }
  52. #endif
  53. </pre>
  54. <div class='footerlink'>
  55. [<a href='hexload.c.html' title=' hexload.c '>PREV</a>]
  56. [<a href='toolkit.html' title=' Index '>HOME</a>]
  57. [<a href='hexout.c.html' title=' hexout.c '>NEXT</a>]
  58. </div>
  59. </body>
  60. </html>