Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2875 dpurdie 1
#pragma force_top_level
2
#pragma include_only_once
3
 
4
/* stdio.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.9 */
5
/* Copyright (C) Codemist Ltd., 1988-1993                       */
6
/* Copyright (C) Advanced Risc Machines Ltd., 1991-1998 -       */
7
/* All rights reserved */
8
 
9
/*
10
 * RCS $Revision: 1.6 $
11
 * Checkin $Date: 1998/05/19 09:54:37 $
12
 * Revising $Author: wdijkstr $
13
 */
14
 
15
/*
16
 * stdio.h declares two types, several macros, and many functions for
17
 * performing input and output. For a discussion on Streams and Files
18
 * refer to sections 4.9.2 and 4.9.3 in the above ANSI draft, or to a
19
 * modern textbook on C.
20
 */
21
 
22
#ifndef __stdio_h
23
#define __stdio_h
24
 
25
#ifdef __cplusplus
26
extern "C" {
27
#endif
28
 
29
#ifndef __size_t
30
#define __size_t 1
31
typedef unsigned int size_t;   /* from <stddef.h> */
32
#endif
33
 
34
/* ANSI forbids va_list to be defined here */
35
typedef char *__va_list[1];       /* keep in step with <stdarg.h> */
36
 
37
#ifndef NULL
38
#  define NULL 0                /* see <stddef.h> */
39
#endif
40
 
41
typedef struct __fpos_t_struct
42
{ unsigned long __lo;             /* add hi one day */
43
} fpos_t;
44
   /*
45
    * fpos_t is an object capable of recording all information needed to
46
    * specify uniquely every position within a file.
47
    */
48
 
49
typedef struct __FILE FILE;
50
   /*
51
    * FILE is an object capable of recording all information needed to control
52
    * a stream, such as its file position indicator, a pointer to its
53
    * associated buffer, an error indicator that records whether a read/write
54
    * error has occurred and an end-of-file indicator that records whether the
55
    * end-of-file has been reached.
56
    * Its structure is not made known to library clients.
57
    */
58
 
59
#define _IOFBF           0x100 /* fully buffered IO */
60
#define _IOLBF           0x200 /* line buffered IO */
61
#define _IONBF           0x400 /* unbuffered IO */
62
 
63
    /* Various default file IO buffer sizes */
64
#define BUFSIZ       (512)  /* system buffer size (as used by setbuf) */
65
#define STDIN_BUFSIZ  (64)  /* default stdin buffer size */
66
#define STDOUT_BUFSIZ (64)  /* default stdout buffer size */
67
#define STDERR_BUFSIZ (16)  /* default stderr buffer size */
68
 
69
#define EOF      (-1)
70
   /*
71
    * negative integral constant, indicates end-of-file, that is, no more input
72
    * from a stream.
73
    */
74
/* It is not clear to me what value FOPEN_MAX should have, so I will
75
   err in the cautious direction - ANSI requires it to be at least 8 */
76
#define FOPEN_MAX 8           /* check re arthur/unix/mvs */
77
   /*
78
    * an integral constant expression that is the minimum number of files that
79
    * this implementation guarantees can be open simultaneously.
80
    */
81
/* _SYS_OPEN defines a limit on the number of open files that is imposed
82
   by this C library */
83
#define _SYS_OPEN 16
84
#define FILENAME_MAX 80
85
   /*
86
    * an integral constant expression that is the size of an array of char
87
    * large enough to hold the longest filename string
88
    */
89
#define L_tmpnam FILENAME_MAX
90
   /*
91
    * an integral constant expression that is the size of an array of char
92
    * large enough to hold a temporary file name string generated by the
93
    * tmpnam function.
94
    */
95
 
96
#define SEEK_SET 0 /* start of stream (see fseek) */
97
#define SEEK_CUR 1 /* current position in stream (see fseek) */
98
#define SEEK_END 2 /* end of stream (see fseek) */
99
 
100
#define TMP_MAX 256
101
   /*
102
    * an integral constant expression that is the minimum number of unique
103
    * file names that shall be generated by the tmpnam function.
104
    */
105
 
106
extern FILE __stdin, __stdout, __stderr;
107
 
108
#define stdin  (&__stdin)
109
   /* pointer to a FILE object associated with standard input stream */
110
#define stdout (&__stdout)
111
   /* pointer to a FILE object associated with standard output stream */
112
#define stderr (&__stderr)
113
   /* pointer to a FILE object associated with standard error stream */
114
 
115
extern int remove(const char * /*filename*/);
116
   /*
117
    * causes the file whose name is the string pointed to by filename to be
118
    * removed. Subsequent attempts to open the file will fail, unless it is
119
    * created anew. If the file is open, the behaviour of the remove function
120
    * is implementation-defined (under RISCOS/Arthur/Brazil the operation
121
    * fails).
122
    * Returns: zero if the operation succeeds, nonzero if it fails.
123
    */
124
extern int rename(const char * /*old*/, const char * /*new*/);
125
   /*
126
    * causes the file whose name is the string pointed to by old to be
127
    * henceforth known by the name given by the string pointed to by new. The
128
    * file named old is effectively removed. If a file named by the string
129
    * pointed to by new exists prior to the call of the rename function, the
130
    * behaviour is implementation-defined (under RISCOS/Arthur/Brazil, the
131
    * operation fails).
132
    * Returns: zero if the operation succeeds, nonzero if it fails, in which
133
    *          case if the file existed previously it is still known by its
134
    *          original name.
135
    */
136
extern FILE *tmpfile(void);
137
   /*
138
    * creates a temporary binary file that will be automatically removed when
139
    * it is closed or at program termination. The file is opened for update.
140
    * Returns: a pointer to the stream of the file that it created. If the file
141
    *          cannot be created, a null pointer is returned.
142
    */
143
extern char *tmpnam(char * /*s*/);
144
   /*
145
    * generates a string that is not the same as the name of an existing file.
146
    * The tmpnam function generates a different string each time it is called,
147
    * up to TMP_MAX times. If it is called more than TMP_MAX times, the
148
    * behaviour is implementation-defined (under RISCOS/Arthur/Brazil the
149
    * algorithm for the name generation works just as well after tmpnam has
150
    * been called more than TMP_MAX times as before; a name clash is impossible
151
    * in any single half year period).
152
    * Returns: If the argument is a null pointer, the tmpnam function leaves
153
    *          its result in an internal static object and returns a pointer to
154
    *          that object. Subsequent calls to the tmpnam function may modify
155
    *          the same object. if the argument is not a null pointer, it is
156
    *          assumed to point to an array of at least L_tmpnam characters;
157
    *          the tmpnam function writes its result in that array and returns
158
    *          the argument as its value.
159
    */
160
 
161
extern int fclose(FILE * /*stream*/);
162
   /*
163
    * causes the stream pointed to by stream to be flushed and the associated
164
    * file to be closed. Any unwritten buffered data for the stream are
165
    * delivered to the host environment to be written to the file; any unread
166
    * buffered data are discarded. The stream is disassociated from the file.
167
    * If the associated buffer was automatically allocated, it is deallocated.
168
    * Returns: zero if the stream was succesfully closed, or nonzero if any
169
    *          errors were detected or if the stream was already closed.
170
    */
171
extern int fflush(FILE * /*stream*/);
172
   /*
173
    * If the stream points to an output or update stream in which the most
174
    * recent operation was output, the fflush function causes any unwritten
175
    * data for that stream to be delivered to the host environment to be
176
    * written to the file. If the stream points to an input or update stream,
177
    * the fflush function undoes the effect of any preceding ungetc operation
178
    * on the stream.
179
    * Returns: nonzero if a write error occurs.
180
    */
181
extern FILE *fopen(const char * /*filename*/, const char * /*mode*/);
182
   /*
183
    * opens the file whose name is the string pointed to by filename, and
184
    * associates a stream with it.
185
    * The argument mode points to a string beginning with one of the following
186
    * sequences:
187
    * "r"         open text file for reading
188
    * "w"         create text file for writing, or truncate to zero length
189
    * "a"         append; open text file or create for writing at eof
190
    * "rb"        open binary file for reading
191
    * "wb"        create binary file for writing, or truncate to zero length
192
    * "ab"        append; open binary file or create for writing at eof
193
    * "r+"        open text file for update (reading and writing)
194
    * "w+"        create text file for update, or truncate to zero length
195
    * "a+"        append; open text file or create for update, writing at eof
196
    * "r+b"/"rb+" open binary file for update (reading and writing)
197
    * "w+b"/"wb+" create binary file for update, or truncate to zero length
198
    * "a+b"/"ab+" append; open binary file or create for update, writing at eof
199
    *
200
    * Opening a file with read mode ('r' as the first character in the mode
201
    * argument) fails if the file does not exist or cannot be read.
202
    * Opening a file with append mode ('a' as the first character in the mode
203
    * argument) causes all subsequent writes to be forced to the current end of
204
    * file, regardless of intervening calls to the fseek function. In some
205
    * implementations, opening a binary file with append mode ('b' as the
206
    * second or third character in the mode argument) may initially position
207
    * the file position indicator beyond the last data written, because of the
208
    * NUL padding (but not under RISCOS/Arthur/Brazil).
209
    * When a file is opened with update mode ('+' as the second or third
210
    * character in the mode argument), both input and output may be performed
211
    * on the associated stream. However, output may not be directly followed by
212
    * input without an intervening call to the fflush fuction or to a file
213
    * positioning function (fseek, fsetpos, or rewind), and input be not be
214
    * directly followed by output without an intervening call to the fflush
215
    * fuction or to a file positioning function, unless the input operation
216
    * encounters end-of-file. Opening a file with update mode may open or
217
    * create a binary stream in some implementations (but not under RISCOS/
218
    * Arthur/Brazil). When opened, a stream is fully buffered if and only if
219
    * it does not refer to an interactive device. The error and end-of-file
220
    * indicators for the stream are cleared.
221
    * Returns: a pointer to the object controlling the stream. If the open
222
    *          operation fails, fopen returns a null pointer.
223
    */
224
extern FILE *freopen(const char * /*filename*/, const char * /*mode*/,
225
                     FILE * /*stream*/);
226
   /*
227
    * opens the file whose name is the string pointed to by filename and
228
    * associates the stream pointed to by stream with it. The mode argument is
229
    * used just as in the fopen function.
230
    * The freopen function first attempts to close any file that is associated
231
    * with the specified stream. Failure to close the file successfully is
232
    * ignored. The error and end-of-file indicators for the stream are cleared.
233
    * Returns: a null pointer if the operation fails. Otherwise, freopen
234
    *          returns the value of the stream.
235
    */
236
extern void setbuf(FILE * /*stream*/, char * /*buf*/);
237
   /*
238
    * Except that it returns no value, the setbuf function is equivalent to the
239
    * setvbuf function invoked with the values _IOFBF for mode and BUFSIZ for
240
    * size, or (if buf is a null pointer), with the value _IONBF for mode.
241
    * Returns: no value.
242
    */
243
extern int setvbuf(FILE * /*stream*/, char * /*buf*/,
244
                   int /*mode*/, size_t /*size*/);
245
   /*
246
    * may be used after the stream pointed to by stream has been associated
247
    * with an open file but before it is read or written. The argument mode
248
    * determines how stream will be buffered, as follows: _IOFBF causes
249
    * input/output to be fully buffered; _IOLBF causes output to be line
250
    * buffered (the buffer will be flushed when a new-line character is
251
    * written, when the buffer is full, or when input is requested); _IONBF
252
    * causes input/output to be completely unbuffered. If buf is not the null
253
    * pointer, the array it points to may be used instead of an automatically
254
    * allocated buffer (the buffer must have a lifetime at least as great as
255
    * the open stream, so the stream should be closed before a buffer that has
256
    * automatic storage duration is deallocated upon block exit). The argument
257
    * size specifies the size of the array. The contents of the array at any
258
    * time are indeterminate.
259
    * Returns: zero on success, or nonzero if an invalid value is given for
260
    *          mode or size, or if the request cannot be honoured.
261
    */
262
 
263
#pragma -v1   /* hint to the compiler to check f/s/printf format */
264
extern int fprintf(FILE * /*stream*/, const char * /*format*/, ...);
265
   /*
266
    * writes output to the stream pointed to by stream, under control of the
267
    * string pointed to by format that specifies how subsequent arguments are
268
    * converted for output. If there are insufficient arguments for the format,
269
    * the behaviour is undefined. If the format is exhausted while arguments
270
    * remain, the excess arguments are evaluated but otherwise ignored. The
271
    * fprintf function returns when the end of the format string is reached.
272
    * The format shall be a multibyte character sequence, beginning and ending
273
    * in its initial shift state. The format is composed of zero or more
274
    * directives: ordinary multibyte characters (not %), which are copied
275
    * unchanged to the output stream; and conversion specifiers, each of which
276
    * results in fetching zero or more subsequent arguments. Each conversion
277
    * specification is introduced by the character %. For a description of the
278
    * available conversion specifiers refer to section 4.9.6.1 in the ANSI
279
    * draft mentioned at the start of this file or to any modern textbook on C.
280
    * The minimum value for the maximum number of characters producable by any
281
    * single conversion is at least 509.
282
    * Returns: the number of characters transmitted, or a negative value if an
283
    *          output error occurred.
284
    */
285
extern int printf(const char * /*format*/, ...);
286
   /*
287
    * is equivalent to fprintf with the argument stdout interposed before the
288
    * arguments to printf.
289
    * Returns: the number of characters transmitted, or a negative value if an
290
    *          output error occurred.
291
    */
292
extern int sprintf(char * /*s*/, const char * /*format*/, ...);
293
   /*
294
    * is equivalent to fprintf, except that the argument s specifies an array
295
    * into which the generated output is to be written, rather than to a
296
    * stream. A null character is written at the end of the characters written;
297
    * it is not counted as part of the returned sum.
298
    * Returns: the number of characters written to the array, not counting the
299
    *          terminating null character.
300
    */
301
#pragma -v2   /* hint to the compiler to check f/s/scanf format */
302
extern int fscanf(FILE * /*stream*/, const char * /*format*/, ...);
303
   /*
304
    * reads input from the stream pointed to by stream, under control of the
305
    * string pointed to by format that specifies the admissible input sequences
306
    * and how thay are to be converted for assignment, using subsequent
307
    * arguments as pointers to the objects to receive the converted input. If
308
    * there are insufficient arguments for the format, the behaviour is
309
    * undefined. If the format is exhausted while arguments remain, the excess
310
    * arguments are evaluated but otherwise ignored.
311
    * The format is composed of zero or more directives: one or more
312
    * white-space characters; an ordinary character (not %); or a conversion
313
    * specification. Each conversion specification is introduced by the
314
    * character %. For a description of the available conversion specifiers
315
    * refer to section 4.9.6.2 in the ANSI draft mentioned at the start of this
316
    * file, or to any modern textbook on C.
317
    * If end-of-file is encountered during input, conversion is terminated. If
318
    * end-of-file occurs before any characters matching the current directive
319
    * have been read (other than leading white space, where permitted),
320
    * execution of the current directive terminates with an input failure;
321
    * otherwise, unless execution of the current directive is terminated with a
322
    * matching failure, execution of the following directive (if any) is
323
    * terminated with an input failure.
324
    * If conversions terminates on a conflicting input character, the offending
325
    * input character is left unread in the input strem. Trailing white space
326
    * (including new-line characters) is left unread unless matched by a
327
    * directive. The success of literal matches and suppressed asignments is
328
    * not directly determinable other than via the %n directive.
329
    * Returns: the value of the macro EOF if an input failure occurs before any
330
    *          conversion. Otherwise, the fscanf function returns the number of
331
    *          input items assigned, which can be fewer than provided for, or
332
    *          even zero, in the event of an early conflict between an input
333
    *          character and the format.
334
    */
335
extern int scanf(const char * /*format*/, ...);
336
   /*
337
    * is equivalent to fscanf with the argument stdin interposed before the
338
    * arguments to scanf.
339
    * Returns: the value of the macro EOF if an input failure occurs before any
340
    *          conversion. Otherwise, the scanf function returns the number of
341
    *          input items assigned, which can be fewer than provided for, or
342
    *          even zero, in the event of an early matching failure.
343
    */
344
extern int sscanf(const char * /*s*/, const char * /*format*/, ...);
345
   /*
346
    * is equivalent to fscanf except that the argument s specifies a string
347
    * from which the input is to be obtained, rather than from a stream.
348
    * Reaching the end of the string is equivalent to encountering end-of-file
349
    * for the fscanf function.
350
    * Returns: the value of the macro EOF if an input failure occurs before any
351
    *          conversion. Otherwise, the scanf function returns the number of
352
    *          input items assigned, which can be fewer than provided for, or
353
    *          even zero, in the event of an early matching failure.
354
    */
355
#pragma -v0   /* back to default */
356
extern int vprintf(const char * /*format*/, __va_list /*arg*/);
357
   /*
358
    * is equivalent to printf, with the variable argument list replaced by arg,
359
    * which has been initialised by the va_start macro (and possibly subsequent
360
    * va_arg calls). The vprintf function does not invoke the va_end function.
361
    * Returns: the number of characters transmitted, or a negative value if an
362
    *          output error occurred.
363
    */
364
extern int vfprintf(FILE * /*stream*/,
365
                   const char * /*format*/, __va_list /*arg*/);
366
   /*
367
    * is equivalent to fprintf, with the variable argument list replaced by
368
    * arg, which has been initialised by the va_start macro (and possibly
369
    * subsequent va_arg calls). The vfprintf function does not invoke the
370
    * va_end function.
371
    * Returns: the number of characters transmitted, or a negative value if an
372
    *          output error occurred.
373
    */
374
extern int vsprintf(char * /*s*/, const char * /*format*/, __va_list /*arg*/);
375
   /*
376
    * is equivalent to sprintf, with the variable argument list replaced by
377
    * arg, which has been initialised by the va_start macro (and possibly
378
    * subsequent va_arg calls). The vsprintf function does not invoke the
379
    * va_end function.
380
    * Returns: the number of characters written in the array, not counting the
381
    *          terminating null character.
382
    */
383
 
384
extern int fgetc(FILE * /*stream*/);
385
   /*
386
    * obtains the next character (if present) as an unsigned char converted to
387
    * an int, from the input stream pointed to by stream, and advances the
388
    * associated file position indicator (if defined).
389
    * Returns: the next character from the input stream pointed to by stream.
390
    *          If the stream is at end-of-file, the end-of-file indicator is
391
    *          set and fgetc returns EOF. If a read error occurs, the error
392
    *          indicator is set and fgetc returns EOF.
393
    */
394
extern char *fgets(char * /*s*/, int /*n*/, FILE * /*stream*/);
395
   /*
396
    * reads at most one less than the number of characters specified by n from
397
    * the stream pointed to by stream into the array pointed to by s. No
398
    * additional characters are read after a new-line character (which is
399
    * retained) or after end-of-file. A null character is written immediately
400
    * after the last character read into the array.
401
    * Returns: s if successful. If end-of-file is encountered and no characters
402
    *          have been read into the array, the contents of the array remain
403
    *          unchanged and a null pointer is returned. If a read error occurs
404
    *          during the operation, the array contents are indeterminate and a
405
    *          null pointer is returned.
406
    */
407
extern int fputc(int /*c*/, FILE * /*stream*/);
408
   /*
409
    * writes the character specified by c (converted to an unsigned char) to
410
    * the output stream pointed to by stream, at the position indicated by the
411
    * asociated file position indicator (if defined), and advances the
412
    * indicator appropriately. If the file position indicator is not defined,
413
    * the character is appended to the output stream.
414
    * Returns: the character written. If a write error occurs, the error
415
    *          indicator is set and fputc returns EOF.
416
    */
417
extern int fputs(const char * /*s*/, FILE * /*stream*/);
418
   /*
419
    * writes the string pointed to by s to the stream pointed to by stream.
420
    * The terminating null character is not written.
421
    * Returns: EOF if a write error occurs; otherwise it returns a nonnegative
422
    *          value.
423
    */
424
extern int getc(FILE * /*stream*/);
425
   /*
426
    * is equivalent to fgetc except that it may be implemented as an unsafe
427
    * macro (stream may be evaluated more than once, so the argument should
428
    * never be an expression with side-effects).
429
    * Returns: the next character from the input stream pointed to by stream.
430
    *          If the stream is at end-of-file, the end-of-file indicator is
431
    *          set and getc returns EOF. If a read error occurs, the error
432
    *          indicator is set and getc returns EOF.
433
    */
434
#define getchar() getc(stdin)
435
extern int (getchar)(void);
436
   /*
437
    * is equivalent to getc with the argument stdin.
438
    * Returns: the next character from the input stream pointed to by stdin.
439
    *          If the stream is at end-of-file, the end-of-file indicator is
440
    *          set and getchar returns EOF. If a read error occurs, the error
441
    *          indicator is set and getchar returns EOF.
442
    */
443
extern char *gets(char * /*s*/);
444
   /*
445
    * reads characters from the input stream pointed to by stdin into the array
446
    * pointed to by s, until end-of-file is encountered or a new-line character
447
    * is read. Any new-line character is discarded, and a null character is
448
    * written immediately after the last character read into the array.
449
    * Returns: s if successful. If end-of-file is encountered and no characters
450
    *          have been read into the array, the contents of the array remain
451
    *          unchanged and a null pointer is returned. If a read error occurs
452
    *          during the operation, the array contents are indeterminate and a
453
    *          null pointer is returned.
454
    */
455
extern int putc(int /*c*/, FILE * /*stream*/);
456
   /*
457
    * is equivalent to fputc except that it may be implemented as aan unsafe
458
    * macro (stream may be evaluated more than once, so the argument should
459
    * never be an expression with side-effects).
460
    * Returns: the character written. If a write error occurs, the error
461
    *          indicator is set and putc returns EOF.
462
    */
463
#define putchar(ch) putc(ch, stdout)
464
extern int (putchar)(int /*c*/);
465
   /*
466
    * is equivalent to putc with the second argument stdout.
467
    * Returns: the character written. If a write error occurs, the error
468
    *          indicator is set and putc returns EOF.
469
    */
470
extern int puts(const char * /*s*/);
471
   /*
472
    * writes the string pointed to by s to the stream pointed to by stdout, and
473
    * appends a new-line character to the output. The terminating null
474
    * character is not written.
475
    * Returns: EOF if a write error occurs; otherwise it returns a nonnegative
476
    *          value.
477
    */
478
extern int ungetc(int /*c*/, FILE * /*stream*/);
479
   /*
480
    * pushes the character specified by c (converted to an unsigned char) back
481
    * onto the input stream pointed to by stream. The character will be
482
    * returned by the next read on that stream. An intervening call to the
483
    * fflush function or to a file positioning function (fseek, fsetpos,
484
    * rewind) discards any pushed-back characters. The external storage
485
    * corresponding to the stream is unchanged.
486
    * One character pushback is guaranteed. If the unget function is called too
487
    * many times on the same stream without an intervening read or file
488
    * positioning operation on that stream, the operation may fail.
489
    * If the value of c equals that of the macro EOF, the operation fails and
490
    * the input stream is unchanged.
491
    * A successful call to the ungetc function clears the end-of-file
492
    * indicator. The value of the file position indicator after reading or
493
    * discarding all pushed-back characters shall be the same as it was before
494
    * the characters were pushed back. For a text stream, the value of the file
495
    * position indicator after a successful call to the ungetc function is
496
    * unspecified until all pushed-back characters are read or discarded. For a
497
    * binary stream, the file position indicator is decremented by each
498
    * successful call to the ungetc function; if its value was zero before a
499
    * call, it is indeterminate after the call.
500
    * Returns: the character pushed back after conversion, or EOF if the
501
    *          operation fails.
502
    */
503
 
504
extern size_t fread(void * /*ptr*/,
505
                    size_t /*size*/, size_t /*nmemb*/, FILE * /*stream*/);
506
   /*
507
    * reads into the array pointed to by ptr, up to nmemb members whose size is
508
    * specified by size, from the stream pointed to by stream. The file
509
    * position indicator (if defined) is advanced by the number of characters
510
    * successfully read. If an error occurs, the resulting value of the file
511
    * position indicator is indeterminate. If a partial member is read, its
512
    * value is indeterminate. The ferror or feof function shall be used to
513
    * distinguish between a read error and end-of-file.
514
    * Returns: the number of members successfully read, which may be less than
515
    *          nmemb if a read error or end-of-file is encountered. If size or
516
    *          nmemb is zero, fread returns zero and the contents of the array
517
    *          and the state of the stream remain unchanged.
518
    */
519
extern size_t fwrite(const void * /*ptr*/,
520
                    size_t /*size*/, size_t /*nmemb*/, FILE * /*stream*/);
521
   /*
522
    * writes, from the array pointed to by ptr up to nmemb members whose size
523
    * is specified by size, to the stream pointed to by stream. The file
524
    * position indicator (if defined) is advanced by the number of characters
525
    * successfully written. If an error occurs, the resulting value of the file
526
    * position indicator is indeterminate.
527
    * Returns: the number of members successfully written, which will be less
528
    *          than nmemb only if a write error is encountered.
529
    */
530
 
531
extern int fgetpos(FILE * /*stream*/, fpos_t * /*pos*/);
532
   /*
533
    * stores the current value of the file position indicator for the stream
534
    * pointed to by stream in the object pointed to by pos. The value stored
535
    * contains unspecified information usable by the fsetpos function for
536
    * repositioning the stream to its position at the time  of the call to the
537
    * fgetpos function.
538
    * Returns: zero, if successful. Otherwise nonzero is returned and the
539
    *          integer expression errno is set to an implementation-defined
540
    *          nonzero value (under RISCOS/Arthur/Brazil fgetpos cannot fail).
541
    */
542
extern int fseek(FILE * /*stream*/, long int /*offset*/, int /*whence*/);
543
   /*
544
    * sets the file position indicator for the stream pointed to by stream.
545
    * For a binary stream, the new position is at the signed number of
546
    * characters specified by offset away from the point specified by whence.
547
    * The specified point is the beginning of the file for SEEK_SET, the
548
    * current position in the file for SEEK_CUR, or end-of-file for SEEK_END.
549
    * A binary stream need not meaningfully support fseek calls with a whence
550
    * value of SEEK_END.
551
    * For a text stream, either offset shall be zero, or offset shall be a
552
    * value returned by an earlier call to the ftell function on the same
553
    * stream and whence shall be SEEK_SET.
554
    * The fseek function clears the end-of-file indicator and undoes any
555
    * effects of the ungetc function on the same stream. After an fseek call,
556
    * the next operation on an update stream may be either input or output.
557
    * Returns: nonzero only for a request that cannot be satisfied.
558
    */
559
extern int fsetpos(FILE * /*stream*/, const fpos_t * /*pos*/);
560
   /*
561
    * sets  the file position indicator for the stream pointed to by stream
562
    * according to the value of the object pointed to by pos, which shall be a
563
    * value returned by an earlier call to the fgetpos function on the same
564
    * stream.
565
    * The fsetpos function clears the end-of-file indicator and undoes any
566
    * effects of the ungetc function on the same stream. After an fsetpos call,
567
    * the next operation on an update stream may be either input or output.
568
    * Returns: zero, if successful. Otherwise nonzero is returned and the
569
    *          integer expression errno is set to an implementation-defined
570
    *          nonzero value (under RISCOS/Arthur/Brazil the value that of EDOM
571
    *          in math.h).
572
    */
573
extern long int ftell(FILE * /*stream*/);
574
   /*
575
    * obtains the current value of the file position indicator for the stream
576
    * pointed to by stream. For a binary stream, the value is the number of
577
    * characters from the beginning of the file. For a text stream, the file
578
    * position indicator contains unspecified information, usable by the fseek
579
    * function for returning the file position indicator to its position at the
580
    * time of the ftell call; the difference between two such return values is
581
    * not necessarily a meaningful measure of the number of characters written
582
    * or read.
583
    * Returns: if successful, the current value of the file position indicator.
584
    *          On failure, the ftell function returns -1L and sets the integer
585
    *          expression errno to an implementation-defined nonzero value
586
    *          (under RISCOS/Arthur/Brazil ftell cannot fail).
587
    */
588
extern void rewind(FILE * /*stream*/);
589
   /*
590
    * sets the file position indicator for the stream pointed to by stream to
591
    * the beginning of the file. It is equivalent to
592
    *          (void)fseek(stream, 0L, SEEK_SET)
593
    * except that the error indicator for the stream is also cleared.
594
    * Returns: no value.
595
    */
596
 
597
extern void clearerr(FILE * /*stream*/);
598
   /*
599
    * clears the end-of-file and error indicators for the stream pointed to by
600
    * stream. These indicators are cleared only when the file is opened or by
601
    * an explicit call to the clearerr function or to the rewind function.
602
    * Returns: no value.
603
    */
604
 
605
extern int feof(FILE * /*stream*/);
606
   /*
607
    * tests the end-of-file indicator for the stream pointed to by stream.
608
    * Returns: nonzero iff the end-of-file indicator is set for stream.
609
    */
610
extern int ferror(FILE * /*stream*/);
611
   /*
612
    * tests the error indicator for the stream pointed to by stream.
613
    * Returns: nonzero iff the error indicator is set for stream.
614
    */
615
extern void perror(const char * /*s*/);
616
   /*
617
    * maps the error number  in the integer expression errno to an error
618
    * message. It writes a sequence of characters to the standard error stream
619
    * thus: first (if s is not a null pointer and the character pointed to by
620
    * s is not the null character), the string pointed to by s followed by a
621
    * colon and a space; then an appropriate error message string followed by
622
    * a new-line character. The contents of the error message strings are the
623
    * same as those returned by the strerror function with argument errno,
624
    * which are implementation-defined.
625
    * Returns: no value.
626
    */
627
 
628
#ifdef __cplusplus
629
}
630
#endif
631
 
632
#endif
633
 
634
/* end of stdio.h */