186 |
than the function-like fdev_setup_stream(), so all data |
than the function-like fdev_setup_stream(), so all data |
187 |
initialization happens during C start-up. |
initialization happens during C start-up. |
188 |
|
|
189 |
|
If streams initialized that way are no longer needed, they can be |
190 |
|
destroyed by first calling the macro fdev_close(), and then |
191 |
|
destroying the object itself. No call to fclose() should be |
192 |
|
issued for these streams. While calling fclose() itself is |
193 |
|
harmless, it will cause an undefined reference to free() and thus |
194 |
|
cause the linker to link the malloc module into the application. |
195 |
|
|
196 |
<h3>Notes</h3> |
<h3>Notes</h3> |
197 |
|
|
198 |
\anchor stdio_note1 \par Note 1: |
\anchor stdio_note1 \par Note 1: |
253 |
#define __SERR 0x0010 /* found error */ |
#define __SERR 0x0010 /* found error */ |
254 |
#define __SEOF 0x0020 /* found EOF */ |
#define __SEOF 0x0020 /* found EOF */ |
255 |
#define __SUNGET 0x040 /* ungetc() happened */ |
#define __SUNGET 0x040 /* ungetc() happened */ |
256 |
|
#define __SMALLOC 0x80 /* handle is malloc()ed */ |
257 |
#if 0 |
#if 0 |
258 |
/* possible future extensions, will require uint16_t flags */ |
/* possible future extensions, will require uint16_t flags */ |
259 |
#define __SRW 0x0080 /* open for reading & writing */ |
#define __SRW 0x0100 /* open for reading & writing */ |
260 |
#define __SLBF 0x0100 /* line buffered */ |
#define __SLBF 0x0200 /* line buffered */ |
261 |
#define __SNBF 0x0200 /* unbuffered */ |
#define __SNBF 0x0400 /* unbuffered */ |
262 |
#define __SMBF 0x0400 /* buf is from malloc */ |
#define __SMBF 0x0800 /* buf is from malloc */ |
263 |
#endif |
#endif |
264 |
int size; /* size of buffer */ |
int size; /* size of buffer */ |
265 |
int len; /* characters read or written so far */ |
int len; /* characters read or written so far */ |
426 |
This function closes \c stream, and disallows and further |
This function closes \c stream, and disallows and further |
427 |
IO to and from it. |
IO to and from it. |
428 |
|
|
429 |
|
When using fdevopen() to setup the stream, a call to fclose() is |
430 |
|
needed in order to free the internal resources allocated. |
431 |
|
|
432 |
|
If the stream has been set up using fdev_setup_stream() or |
433 |
|
FDEV_SETUP_STREAM(), use fdev_close() instead. |
434 |
|
|
435 |
It currently always returns 0 (for success). |
It currently always returns 0 (for success). |
436 |
*/ |
*/ |
437 |
extern int fclose(FILE *__stream); |
extern int fclose(FILE *__stream); |
438 |
|
|
439 |
/** |
/** |
440 |
|
This macro frees up any library resources that might be associated |
441 |
|
with \c stream. It should be called if \c stream is no longer |
442 |
|
needed, right before the application is going to destroy the |
443 |
|
\c stream object itself. |
444 |
|
|
445 |
|
(Currently, this macro evaluates to nothing, but this might change |
446 |
|
in future versions of the library.) |
447 |
|
*/ |
448 |
|
#if defined(__DOXYGEN__) |
449 |
|
# define fdev_close() |
450 |
|
#else |
451 |
|
# define fdev_close() ((void)0) |
452 |
|
#endif |
453 |
|
|
454 |
|
/** |
455 |
\c vfprintf is the central facility of the \c printf family of |
\c vfprintf is the central facility of the \c printf family of |
456 |
functions. It outputs values to \c stream under control of a |
functions. It outputs values to \c stream under control of a |
457 |
format string passed in \c fmt. The actual values to print are |
format string passed in \c fmt. The actual values to print are |