Subversion Repositories Kolibri OS

Rev

Rev 4921 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4921 Rev 6099
Line 15... Line 15...
15
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16
 */
16
 */
Line 17... Line 17...
17
 
17
 
18
/*
18
/*
19
FUNCTION
19
FUNCTION
Line 20... Line 20...
20
<>---write array elements
20
<>, <>---write array elements
21
 
21
 
22
INDEX
22
INDEX
-
 
23
	fwrite
-
 
24
INDEX
23
	fwrite
25
	fwrite_unlocked
-
 
26
INDEX
-
 
27
	_fwrite_r
Line 24... Line 28...
24
INDEX
28
INDEX
25
	_fwrite_r
29
	_fwrite_unlocked_r
26
 
30
 
27
ANSI_SYNOPSIS
31
ANSI_SYNOPSIS
Line -... Line 32...
-
 
32
	#include 
-
 
33
	size_t fwrite(const void *restrict <[buf]>, size_t <[size]>,
-
 
34
		      size_t <[count]>, FILE *restrict <[fp]>);
-
 
35
 
-
 
36
	#define _BSD_SOURCE
28
	#include 
37
	#include 
29
	size_t fwrite(const void *restrict <[buf]>, size_t <[size]>,
38
	size_t fwrite_unlocked(const void *restrict <[buf]>, size_t <[size]>,
30
		      size_t <[count]>, FILE *restrict <[fp]>);
39
		      size_t <[count]>, FILE *restrict <[fp]>);
Line -... Line 40...
-
 
40
 
-
 
41
	#include 
-
 
42
	size_t _fwrite_r(struct _reent *<[ptr]>, const void *restrict <[buf]>, size_t <[size]>,
-
 
43
		      size_t <[count]>, FILE *restrict <[fp]>);
31
 
44
 
32
	#include 
45
	#include 
33
	size_t _fwrite_r(struct _reent *<[ptr]>, const void *restrict <[buf]>, size_t <[size]>,
46
	size_t _fwrite_unlocked_r(struct _reent *<[ptr]>, const void *restrict <[buf]>, size_t <[size]>,
34
		      size_t <[count]>, FILE *restrict <[fp]>);
47
		      size_t <[count]>, FILE *restrict <[fp]>);
35
 
48
 
36
TRAD_SYNOPSIS
49
TRAD_SYNOPSIS
37
	#include 
50
	#include 
Line -... Line 51...
-
 
51
	size_t fwrite(<[buf]>, <[size]>, <[count]>, <[fp]>)
-
 
52
	char *<[buf]>;
-
 
53
	size_t <[size]>;
-
 
54
	size_t <[count]>;
-
 
55
	FILE *<[fp]>;
-
 
56
 
-
 
57
	#define _BSD_SOURCE
-
 
58
	#include 
38
	size_t fwrite(<[buf]>, <[size]>, <[count]>, <[fp]>)
59
	size_t fwrite_unlocked(<[buf]>, <[size]>, <[count]>, <[fp]>)
39
	char *<[buf]>;
60
	char *<[buf]>;
40
	size_t <[size]>;
61
	size_t <[size]>;
41
	size_t <[count]>;
62
	size_t <[count]>;
42
	FILE *<[fp]>;
63
	FILE *<[fp]>;
43
 
64
 
44
	#include 
65
	#include 
Line -... Line 66...
-
 
66
	size_t _fwrite_r(<[ptr]>, <[buf]>, <[size]>, <[count]>, <[fp]>)
-
 
67
	struct _reent *<[ptr]>;
-
 
68
	char *<[buf]>;
-
 
69
	size_t <[size]>;
-
 
70
	size_t <[count]>;
-
 
71
	FILE *<[fp]>;
-
 
72
 
-
 
73
	#include 
45
	size_t _fwrite_r(<[ptr]>, <[buf]>, <[size]>, <[count]>, <[fp]>)
74
	size_t _fwrite_unlocked_r(<[ptr]>, <[buf]>, <[size]>, <[count]>, <[fp]>)
46
	struct _reent *<[ptr]>;
75
	struct _reent *<[ptr]>;
47
	char *<[buf]>;
76
	char *<[buf]>;
48
	size_t <[size]>;
77
	size_t <[size]>;
49
	size_t <[count]>;
78
	size_t <[count]>;
Line 50... Line 79...
50
	FILE *<[fp]>;
79
	FILE *<[fp]>;
51
 
80
 
Line 52... Line 81...
52
DESCRIPTION
81
DESCRIPTION
-
 
82
<> attempts to copy, starting from the memory location
-
 
83
<[buf]>, <[count]> elements (each of size <[size]>) into the file or
-
 
84
stream identified by <[fp]>.  <> may copy fewer elements than
-
 
85
<[count]> if an error intervenes.
-
 
86
 
-
 
87
<> also advances the file position indicator (if any) for
-
 
88
<[fp]> by the number of @emph{characters} actually written.
-
 
89
 
-
 
90
<> is a non-thread-safe version of <>.
53
<> attempts to copy, starting from the memory location
91
<> may only safely be used within a scope
Line 54... Line 92...
54
<[buf]>, <[count]> elements (each of size <[size]>) into the file or
92
protected by flockfile() (or ftrylockfile()) and funlockfile().  This
55
stream identified by <[fp]>.  <> may copy fewer elements than
93
function may safely be used in a multi-threaded program if and only
56
<[count]> if an error intervenes.
94
if they are called while the invoking thread owns the (FILE *)
57
 
95
object, as is the case after a successful call to the flockfile() or
58
<> also advances the file position indicator (if any) for
96
ftrylockfile() functions.  If threads are disabled, then
Line 59... Line 97...
59
<[fp]> by the number of @emph{characters} actually written.
97
<> is equivalent to <>.
60
 
98
 
Line -... Line 99...
-
 
99
<<_fwrite_r>> and <<_fwrite_unlocked_r>> are simply reentrant versions of the
-
 
100
above that take an additional reentrant structure argument: <[ptr]>.
61
<<_fwrite_r>> is simply the reentrant version of <> that
101
 
62
takes an additional reentrant structure argument: <[ptr]>.
102
RETURNS
63
 
103
If <> succeeds in writing all the elements you specify, the
Line 64... Line 104...
64
RETURNS
104
result is the same as the argument <[count]>.  In any event, the
Line 87... Line 127...
87
#include "local.h"
127
#include "local.h"
88
#if 1
128
#if 1
89
#include "fvwrite.h"
129
#include "fvwrite.h"
90
#endif
130
#endif
Line -... Line 131...
-
 
131
 
-
 
132
#ifdef __IMPL_UNLOCKED__
-
 
133
#define _fwrite_r _fwrite_unlocked_r
-
 
134
#define fwrite fwrite_unlocked
-
 
135
#endif
91
 
136
 
92
/*
137
/*
93
 * Write `count' objects (each size `size') from memory to the given file.
138
 * Write `count' objects (each size `size') from memory to the given file.
94
 * Return the number of whole objects written.
139
 * Return the number of whole objects written.