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
<>---read array elements from a file
20
<>, <>---read array elements from a file
21
 
21
 
22
INDEX
22
INDEX
-
 
23
	fread
-
 
24
INDEX
23
	fread
25
	fread_unlocked
-
 
26
INDEX
-
 
27
	_fread_r
Line 24... Line 28...
24
INDEX
28
INDEX
25
	_fread_r
29
	_fread_unlocked_r
26
 
30
 
27
ANSI_SYNOPSIS
31
ANSI_SYNOPSIS
Line -... Line 32...
-
 
32
	#include 
-
 
33
	size_t fread(void *restrict <[buf]>, size_t <[size]>, size_t <[count]>,
-
 
34
		     FILE *restrict <[fp]>);
-
 
35
 
-
 
36
	#define _BSD_SOURCE
28
	#include 
37
	#include 
29
	size_t fread(void *restrict <[buf]>, size_t <[size]>, size_t <[count]>,
38
	size_t fread_unlocked(void *restrict <[buf]>, size_t <[size]>, size_t <[count]>,
30
		     FILE *restrict <[fp]>);
39
		     FILE *restrict <[fp]>);
Line -... Line 40...
-
 
40
 
-
 
41
	#include 
-
 
42
	size_t _fread_r(struct _reent *<[ptr]>, void *restrict <[buf]>,
-
 
43
	                size_t <[size]>, size_t <[count]>, FILE *restrict <[fp]>);
31
 
44
 
32
	#include 
45
	#include 
33
	size_t _fread_r(struct _reent *<[ptr]>, void *restrict <[buf]>,
46
	size_t _fread_unlocked_r(struct _reent *<[ptr]>, void *restrict <[buf]>,
34
	                size_t <[size]>, size_t <[count]>, FILE *restrict <[fp]>);
47
	                size_t <[size]>, size_t <[count]>, FILE *restrict <[fp]>);
35
 
48
 
36
TRAD_SYNOPSIS
49
TRAD_SYNOPSIS
37
	#include 
50
	#include 
Line -... Line 51...
-
 
51
	size_t fread(<[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 fread(<[buf]>, <[size]>, <[count]>, <[fp]>)
59
	size_t fread_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 _fread_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 _fread_r(<[ptr]>, <[buf]>, <[size]>, <[count]>, <[fp]>)
74
	size_t _fread_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, from the file or stream identified by
-
 
83
<[fp]>, <[count]> elements (each of size <[size]>) into memory,
-
 
84
starting at <[buf]>.   <> may copy fewer elements than
-
 
85
<[count]> if an error, or end of file, intervenes.
-
 
86
 
-
 
87
<> also advances the file position indicator (if any) for
-
 
88
<[fp]> by the number of @emph{characters} actually read.
-
 
89
 
-
 
90
<> is a non-thread-safe version of <>.
53
<> attempts to copy, from the file or stream identified by
91
<> may only safely be used within a scope
Line 54... Line 92...
54
<[fp]>, <[count]> elements (each of size <[size]>) into memory,
92
protected by flockfile() (or ftrylockfile()) and funlockfile().  This
55
starting at <[buf]>.   <> may copy fewer elements than
93
function may safely be used in a multi-threaded program if and only
56
<[count]> if an error, or end of file, intervenes.
94
if they are called while the invoking thread owns the (FILE *)
Line 57... Line 95...
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 -... Line 97...
-
 
97
<> is equivalent to <>.
-
 
98
 
59
<[fp]> by the number of @emph{characters} actually read.
99
<<_fread_r>> and <<_fread_unlocked_r>> are simply reentrant versions of the
60
 
100
above that take an additional reentrant structure pointer argument: <[ptr]>.
61
<<_fread_r>> is simply the reentrant version of <> that
101
 
Line 62... Line 102...
62
takes an additional reentrant structure pointer argument: <[ptr]>.
102
RETURNS
63
 
103
The result of <> is the number of elements it succeeded in
64
RETURNS
104
reading.
65
The result of <> is the number of elements it succeeded in
105
 
66
reading.
106
PORTABILITY
Line -... Line 107...
-
 
107
ANSI C requires <>.
-
 
108
 
-
 
109
<> is a BSD extension also provided by GNU libc.
-
 
110
 
-
 
111
Supporting OS subroutines required: <>, <>, <>,
67
 
112
<>, <>, <>, <>.
68
PORTABILITY
113
*/
69
ANSI C requires <>.
114
 
70
 
115
#include <_ansi.h>
71
Supporting OS subroutines required: <>, <>, <>,
116
#include