mirror of
https://github.com/yasuhirokimura/db18
synced 2026-06-08 18:29:23 +00:00
241 lines
8.5 KiB
HTML
241 lines
8.5 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||
<title>DB_STREAM->read()</title>
|
||
<link rel="stylesheet" href="apiReference.css" type="text/css" />
|
||
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
|
||
<link rel="start" href="index.html" title="Berkeley DB C API Reference" />
|
||
<link rel="up" href="blob.html" title="Chapter 13. External Files" />
|
||
<link rel="prev" href="dbstream_close.html" title="DB_STREAM->close()" />
|
||
<link rel="next" href="dbstream_size.html" title="DB_STREAM->size()" />
|
||
</head>
|
||
<body>
|
||
<div xmlns="" class="navheader">
|
||
<div class="libver">
|
||
<p>Library Version 18.1.40</p>
|
||
</div>
|
||
<table width="100%" summary="Navigation header">
|
||
<tr>
|
||
<th colspan="3" align="center">
|
||
<span xmlns="http://www.w3.org/1999/xhtml">DB_STREAM->read()</span>
|
||
|
||
</th>
|
||
</tr>
|
||
<tr>
|
||
<td width="20%" align="left"><a accesskey="p" href="dbstream_close.html">Prev</a> </td>
|
||
<th width="60%" align="center">Chapter 13.
|
||
External Files
|
||
</th>
|
||
<td width="20%" align="right"> <a accesskey="n" href="dbstream_size.html">Next</a></td>
|
||
</tr>
|
||
</table>
|
||
<hr />
|
||
</div>
|
||
<div class="sect1" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h2 class="title" style="clear: both"><a id="dbstream_read"></a>
|
||
<span>DB_STREAM->read()</span>
|
||
|
||
</h2>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<pre class="programlisting">#include <db.h>
|
||
|
||
int
|
||
DB_STREAM->read(DB_STREAM *dbs, DBT *data, db_off_t offset,
|
||
u_int32_t size, u_int32_t flags); </pre>
|
||
<p>
|
||
The <code class="methodname">DB_STREAM->read()</code> method reads
|
||
<span class="bold"><strong>size</strong></span> bytes from the external file,
|
||
starting at <span class="bold"><strong>offset</strong></span>, into the
|
||
DBT <span class="bold"><strong>data</strong></span>.
|
||
</p>
|
||
<p>
|
||
The stream is created using <a class="xref" href="dbstream.html" title="DBC->db_stream()">
|
||
<span>DBC->db_stream()</span>
|
||
|
||
</a>.
|
||
</p>
|
||
<p>
|
||
Unless otherwise specified, the
|
||
<code class="methodname">DB_STREAM->read()</code> <span>
|
||
<span>
|
||
method returns a non-zero error value on failure and 0 on success.
|
||
</span>
|
||
|
||
</span>
|
||
</p>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="idm139753795524720"></a>Parameters</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="idm139753795512288"></a>data</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <span class="bold"><strong>data</strong></span> parameter is
|
||
the <a class="link" href="dbt.html" title="Chapter 4. The DBT Handle">DBT</a> into which you
|
||
want to place the data read using this method.
|
||
</p>
|
||
<p>
|
||
Note that the data DBT must be set with one of the
|
||
following flags, or this method will return an error:
|
||
<a class="link" href="dbt.html#dbt_DB_DBT_MALLOC">DB_DBT_MALLOC</a>,
|
||
<a class="link" href="dbt.html#dbt_DB_DBT_REALLOC">DB_DBT_REALLOC</a>,
|
||
<a class="link" href="dbt.html#dbt_DB_DBT_USERMEM">DB_DBT_USERMEM</a>, or
|
||
<a class="link" href="dbt.html#dbt_DB_DBT_APPMALLOC">DB_DBT_APPMALLOC</a>.
|
||
</p>
|
||
</div>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="idm139753795462432"></a>offset</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <span class="bold"><strong>offset</strong></span> parameter
|
||
indicates the starting position, in bytes, from the
|
||
beginning of the external file where you want the read to
|
||
begin.
|
||
</p>
|
||
</div>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="idm139753795472832"></a>size</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <span class="bold"><strong>size</strong></span> parameter
|
||
indicates the number of bytes to read.
|
||
</p>
|
||
</div>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="idm139753795460448"></a>flags</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <span class="bold"><strong>flags</strong></span> parameter must be set to 0.
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="idm139753795556416"></a>Errors</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <code class="methodname">DB_STREAM->read()</code> <span>
|
||
<span>
|
||
method may fail and return one of the following non-zero errors:
|
||
</span>
|
||
|
||
</span>
|
||
</p>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="idm139753795460640"></a>DB_BUFFER_SMALL</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The DBT provided to this method was not configured
|
||
appropriately, and so there is not enough space allocated
|
||
for the bytes you are trying to read.
|
||
</p>
|
||
</div>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="idm139753795452816"></a>EINVAL</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
An invalid flag value or parameter was specified; or if the
|
||
DBT was configured with
|
||
<a class="link" href="dbt.html#dbt_DB_DBT_PARTIAL">DB_DBT_PARTIAL</a>.
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="idm139753795461856"></a>Class</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
<a class="link" href="blob.html" title="Chapter 13. External Files">DB_STREAM</a>
|
||
</p>
|
||
</div>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="idm139753795458576"></a>See Also</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
<a class="xref" href="blob.html#bloblist" title="External Files and Related Methods">External Files and Related Methods</a>
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="navfooter">
|
||
<hr />
|
||
<table width="100%" summary="Navigation footer">
|
||
<tr>
|
||
<td width="40%" align="left"><a accesskey="p" href="dbstream_close.html">Prev</a> </td>
|
||
<td width="20%" align="center">
|
||
<a accesskey="u" href="blob.html">Up</a>
|
||
</td>
|
||
<td width="40%" align="right"> <a accesskey="n" href="dbstream_size.html">Next</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td width="40%" align="left" valign="top">
|
||
<span>DB_STREAM->close()</span>
|
||
|
||
</td>
|
||
<td width="20%" align="center">
|
||
<a accesskey="h" href="index.html">Home</a>
|
||
</td>
|
||
<td width="40%" align="right" valign="top">
|
||
<span>DB_STREAM->size()</span>
|
||
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</body>
|
||
</html>
|