1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 <title>DB->get_byteswapped()</title> 7 <link rel="stylesheet" href="apiReference.css" type="text/css" /> 8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> 9 <link rel="start" href="index.html" title="Berkeley DB C API Reference" /> 10 <link rel="up" href="db.html" title="Chapter 2. The DB Handle" /> 11 <link rel="prev" href="dbget_bt_minkey.html" title="DB->get_bt_minkey()" /> 12 <link rel="next" href="dbget_cachesize.html" title="DB->get_cachesize()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DB->get_byteswapped()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="dbget_bt_minkey.html">Prev</a> </td> 22 <th width="60%" align="center">Chapter 2. 23 The DB Handle 24 </th> 25 <td width="20%" align="right"> <a accesskey="n" href="dbget_cachesize.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="dbget_byteswapped"></a>DB->get_byteswapped()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB->get_byteswapped(DB *db, int *isswapped); </pre> 42 <p> 43 The <code class="methodname">DB->get_byteswapped()</code> method returns 44 whether the underlying database 45 files were created on an architecture of the same byte order as the 46 current one, or if they were not (that is, big-endian on a 47 little-endian machine, or vice versa). This information may be used to 48 determine whether application data needs to be adjusted for this 49 architecture or not. 50 </p> 51 <p> 52 The <code class="methodname">DB->get_byteswapped()</code> method may not be called before the 53 <a class="xref" href="dbopen.html" title="DB->open()">DB->open()</a> method is called. 54 </p> 55 <p> 56 The <code class="methodname">DB->get_byteswapped()</code> <span> 57 <span> 58 method returns a non-zero error value on failure and 0 on success. 59 </span> 60 61 </span> 62 </p> 63 <div class="sect2" lang="en" xml:lang="en"> 64 <div class="titlepage"> 65 <div> 66 <div> 67 <h3 class="title"><a id="id1635484"></a>Parameters</h3> 68 </div> 69 </div> 70 </div> 71 <div class="sect3" lang="en" xml:lang="en"> 72 <div class="titlepage"> 73 <div> 74 <div> 75 <h4 class="title"><a id="id1635641"></a>isswapped</h4> 76 </div> 77 </div> 78 </div> 79 <p> 80 If the underlying database files were created on an architecture of 81 the same byte order as the current one, 0 is stored into the memory 82 location referenced by <span class="bold"><strong>isswapped</strong></span>. If 83 the underlying database files were created on an architecture of a 84 different byte order as the current one, 1 is stored into the memory 85 location referenced by <span class="bold"><strong>isswapped</strong></span>. 86 </p> 87 </div> 88 </div> 89 <div class="sect2" lang="en" xml:lang="en"> 90 <div class="titlepage"> 91 <div> 92 <div> 93 <h3 class="title"><a id="id1635678"></a>Errors</h3> 94 </div> 95 </div> 96 </div> 97 <p> 98 The <code class="methodname">DB->get_byteswapped()</code> <span> 99 <span> 100 method may fail and return one of the following non-zero errors: 101 </span> 102 103 </span> 104 </p> 105 <div class="sect3" lang="en" xml:lang="en"> 106 <div class="titlepage"> 107 <div> 108 <div> 109 <h4 class="title"><a id="id1635617"></a>EINVAL</h4> 110 </div> 111 </div> 112 </div> 113 <p> 114 If the method was called before <a class="xref" href="dbopen.html" title="DB->open()">DB->open()</a> 115 was called; or if an invalid flag value or parameter was specified. 116 </p> 117 </div> 118 </div> 119 <div class="sect2" lang="en" xml:lang="en"> 120 <div class="titlepage"> 121 <div> 122 <div> 123 <h3 class="title"><a id="id1635536"></a>Class</h3> 124 </div> 125 </div> 126 </div> 127 <p> 128 <a class="link" href="db.html" title="Chapter 2. The DB Handle">DB</a> 129 </p> 130 </div> 131 <div class="sect2" lang="en" xml:lang="en"> 132 <div class="titlepage"> 133 <div> 134 <div> 135 <h3 class="title"><a id="id1635686"></a>See Also</h3> 136 </div> 137 </div> 138 </div> 139 <p> 140 <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> 141 </p> 142 </div> 143 </div> 144 <div class="navfooter"> 145 <hr /> 146 <table width="100%" summary="Navigation footer"> 147 <tr> 148 <td width="40%" align="left"><a accesskey="p" href="dbget_bt_minkey.html">Prev</a> </td> 149 <td width="20%" align="center"> 150 <a accesskey="u" href="db.html">Up</a> 151 </td> 152 <td width="40%" align="right"> <a accesskey="n" href="dbget_cachesize.html">Next</a></td> 153 </tr> 154 <tr> 155 <td width="40%" align="left" valign="top">DB->get_bt_minkey() </td> 156 <td width="20%" align="center"> 157 <a accesskey="h" href="index.html">Home</a> 158 </td> 159 <td width="40%" align="right" valign="top"> DB->get_cachesize()</td> 160 </tr> 161 </table> 162 </div> 163 </body> 164</html> 165