Imported Upstream version 3.4.1
[platform/upstream/libarchive.git] / doc / man / archive_write_data.3
1 .TH ARCHIVE_WRITE_DATA 3 "February 28, 2017" ""
2 .SH NAME
3 .ad l
4 \fB\%archive_write_data\fP,
5 \fB\%archive_write_data_block\fP
6 \- functions for creating archives
7 .SH LIBRARY
8 .ad l
9 Streaming Archive Library (libarchive, -larchive)
10 .SH SYNOPSIS
11 .ad l
12 \fB#include <archive.h>\fP
13 .br
14 \fIla_ssize_t\fP
15 .br
16 \fB\%archive_write_data\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ void\ *\fP, \fI\%size_t\fP);
17 .br
18 \fIla_ssize_t\fP
19 .br
20 \fB\%archive_write_data_block\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ void\ *\fP, \fI\%size_t\ size\fP, \fI\%int64_t\ offset\fP);
21 .SH DESCRIPTION
22 .ad l
23 .RS 5
24 .TP
25 \fB\%archive_write_data\fP()
26 Write data corresponding to the header just written.
27 .TP
28 \fB\%archive_write_data_block\fP()
29 Write data corresponding to the header just written.
30 This is like
31 \fB\%archive_write_data\fP()
32 except that it performs a seek on the file being
33 written to the specified offset before writing the data.
34 This is useful when restoring sparse files from archive
35 formats that support sparse files.
36 Returns number of bytes written or -1 on error.
37 (Note: This is currently not supported for
38 Tn archive_write
39 handles, only for
40 Tn archive_write_disk
41 handles.
42 .RE
43 .SH RETURN VALUES
44 .ad l
45 This function returns the number of bytes actually written, or
46 a negative error code on error.
47 .SH ERRORS
48 .ad l
49 Detailed error codes and textual descriptions are available from the
50 \fB\%archive_errno\fP()
51 and
52 \fB\%archive_error_string\fP()
53 functions.
54 .SH BUGS
55 .ad l
56 In libarchive 3.x, this function sometimes returns
57 zero on success instead of returning the number of bytes written.
58 Specifically, this occurs when writing to an
59 Vt archive_write_disk
60 handle.
61 Clients should treat any value less than zero as an error
62 and consider any non-negative value as success.
63 .SH SEE ALSO
64 .ad l
65 \fBtar\fP(1),
66 \fBarchive_write_finish_entry\fP(3),
67 \fBarchive_write_set_options\fP(3),
68 \fBlibarchive\fP(3),
69 \fBcpio\fP(5),
70 \fBmtree\fP(5),
71 \fBtar\fP(5)