Nut/OS  4.10.3
API Reference
Standard I/O

Standard stream interface to Nut/OS devices. More...

Collaboration diagram for Standard I/O:

Defines

#define EOF   (-1)
 End of file.
#define _IOFBF   0x00
 Fully buffered.
#define _IOLBF   0x01
 Line buffered.
#define _IONBF   0x02
 Unbuffered.
#define stdin   (__iob[0])
 Standard input stream.
#define stdout   (__iob[1])
 Standard output stream.
#define stderr   (__iob[2])
 Standard error output stream.
#define CF_LONG   0x01
#define CF_SUPPRESS   0x02
#define CF_SIGNOK   0x04
#define CF_NDIGITS   0x08
#define CF_PFXOK   0x10
#define CF_NZDIGITS   0x20
#define CF_DPTOK   0x10
#define CF_EXPOK   0x20
#define CT_CHAR   0
#define CT_STRING   2
#define CT_INT   3
#define CT_FLOAT   4
#define BUF   16
#define PADSIZE   16
#define ALT   0x01
#define LADJUST   0x04
#define LONGINT   0x08
#define ZEROPAD   0x10

Typedefs

typedef struct __iobuf FILE
 Stream structure type.

Functions

void clearerr (FILE *stream)
 Reset error status of a stream.
int fclose (FILE *stream)
 Close a stream.
void fcloseall (void)
 Close all open streams.
FILE_fdopen (int fd, CONST char *mode)
 Open a stream associated with a file, device or socket descriptor.
int feof (FILE *stream)
 Test if a stream reached the end of file.
int ferror (FILE *stream)
 Test for an error on a stream.
int fflush (FILE *stream)
 Flush a stream.
int fgetc (FILE *stream)
 Read a character from a stream.
char * fgets (char *buffer, int count, FILE *stream)
 Read a line from a stream.
int _fileno (FILE *stream)
 Get the file descriptor associated with a stream.
void _flushall (void)
 Flushes all streams.
int _fmode (CONST char *mode)
FILEfopen (CONST char *name, CONST char *mode)
 Open a stream.
int fprintf (FILE *stream, CONST char *fmt,...)
 Print formatted data to a stream.
int fprintf_P (FILE *stream, PGM_P fmt,...)
 Print formatted data to a stream.
int fpurge (FILE *stream)
 Purge a stream, i.e. discards the input buffer.
int fputc (int c, FILE *stream)
 Write a character to a stream.
int fputs (CONST char *string, FILE *stream)
 Write a string to a stream.
int fputs_P (PGM_P string, FILE *stream)
 Write a string from progam memory to a stream.
size_t fread (void *buffer, size_t size, size_t count, FILE *stream)
 Read data from a stream.
FILEfreopen (CONST char *name, CONST char *mode, FILE *stream)
 Reassign a stream.
int fscanf (FILE *stream, CONST char *fmt,...)
 Read formatted data from a stream.
int fscanf_P (FILE *stream, PGM_P fmt,...)
 Read formatted data from a stream.
int fseek (FILE *stream, long offset, int origin)
 Move read/write position of a stream.
long ftell (FILE *stream)
 Return the read/write position of a stream.
size_t fwrite (CONST void *data, size_t size, size_t count, FILE *stream)
 Write data to a stream.
size_t fwrite_P (PGM_P data, size_t size, size_t count, FILE *stream)
 Write data from program space to a stream.
int getc (FILE *stream)
 Read a character from a stream.
int getchar (void)
 Read a character from a standard input.
int _getf (int _getb(int, void *, size_t), int fd, CONST char *fmt, va_list ap)
 Read formatted data using a given input function.
char * gets (char *buffer)
 Get a line from the standard input stream.
int printf (CONST char *fmt,...)
 Print formatted data to the standard output stream.
int printf_P (PGM_P fmt,...)
 Print formatted output to the standard output stream.
int putc (int c, FILE *stream)
 Write a character to a stream.
int putchar (int c)
 Write a character to standard output.
int _putf (int _putb(int, CONST void *, size_t), int fd, CONST char *fmt, va_list ap)
 Write formatted data using a given output function.
int puts (CONST char *string)
 Write a string to stdout.
int puts_P (PGM_P string)
 Write a string from program memory to stdout.
int scanf (CONST char *fmt,...)
 Read formatted data from the standard input stream.
int scanf_P (PGM_P fmt,...)
 Read formatted data from the standard input stream.
int sprintf (char *buffer, CONST char *fmt,...)
 Write formatted data to a string.
int sprintf_P (char *buffer, PGM_P fmt,...)
 Write formatted data to a string.
int sscanf (CONST char *string, CONST char *fmt,...)
 Read formatted data from a string.
int sscanf_P (CONST char *string, CONST char *fmt,...)
 Read formatted data from a string.
int ungetc (int c, FILE *stream)
 Push a character back onto a stream.
int vfprintf (FILE *stream, CONST char *fmt, va_list ap)
 Write argument list to a stream using a given format.
int vfprintf_P (FILE *stream, PGM_P fmt, va_list ap)
 Write argument list to a stream using a given format.
int vfscanf (FILE *stream, CONST char *fmt, va_list ap)
 Read formatted data from a stream.
int vfscanf_P (FILE *stream, PGM_P fmt, va_list ap)
 Read formatted data from a stream.
int vsprintf (char *buffer, CONST char *fmt, va_list ap)
 Write argument list to a string using a given format.
int vsprintf_P (char *buffer, PGM_P fmt, va_list ap)
 Write argument list to a string using a given format.
int vsscanf (CONST char *string, CONST char *fmt, va_list ap)
 Read formatted data from a string.
int vsscanf_P (CONST char *string, PGM_P fmt, va_list ap)
 Read formatted data from a string.

Variables

FILE__iob []
FILE__iob [FOPEN_MAX] = { (FILE *) 1, (FILE *) 2, (FILE *) 3 }

Detailed Description

Standard stream interface to Nut/OS devices.

 #include <stdio.h> 

In contrast to the standard, Nut/OS streams do not maintain there own buffers. Any input or output buffering is done in the device driver.

Nut/OS will not associate the standard streams stdin, stdout and stderr to a device when starting the application. Instead, freopen() can be used by the application to redirect any of these stream to any previously opened file, device or connected socket.

As an extension to the standard, many function come in an additional flavour with _P appended to their name. These functions accept specific parameters pointing into program space.

Output Call Graph

dot_inline_dotgraph_1.png

Input Call Graph

dot_inline_dotgraph_2.png

Define Documentation

#define EOF   (-1)

End of file.

Returned by an input or output operation when the end of a file is encountered. Some routines return this value to indicate an error.

Definition at line 101 of file stdio.h.

Referenced by _fdopen(), _fmode(), _getf(), EdLineRead(), fclose(), fflush(), fgetc(), fgets(), fopen(), fpurge(), fputc(), freopen(), gets(), NutSmtpSendEncodedLines(), puts(), puts_P(), and ungetc().

#define _IOFBF   0x00

Fully buffered.

Definition at line 105 of file stdio.h.

#define _IOLBF   0x01

Line buffered.

Definition at line 106 of file stdio.h.

#define _IONBF   0x02

Unbuffered.

Definition at line 107 of file stdio.h.

#define stdin   (__iob[0])

Standard input stream.

Examples:
caltime/caltime.c, and editconf/editconf.c.

Definition at line 123 of file stdio.h.

Referenced by EdLineOpen(), getchar(), gets(), kbhit(), main(), scanf(), and scanf_P().

#define stderr   (__iob[2])

Standard error output stream.

Examples:
logtime/logtime.c, and snmpd/snmpd.c.

Definition at line 125 of file stdio.h.

Referenced by main(), syslog_flush(), vsyslog(), and vsyslog_P().

#define CF_LONG   0x01

Definition at line 89 of file getf.c.

Referenced by _getf().

#define CF_SUPPRESS   0x02

Definition at line 90 of file getf.c.

Referenced by _getf().

#define CF_SIGNOK   0x04

Definition at line 91 of file getf.c.

Referenced by _getf().

#define CF_NDIGITS   0x08

Definition at line 92 of file getf.c.

Referenced by _getf().

#define CF_PFXOK   0x10

Definition at line 93 of file getf.c.

Referenced by _getf().

#define CF_NZDIGITS   0x20

Definition at line 94 of file getf.c.

Referenced by _getf().

#define CF_DPTOK   0x10

Definition at line 95 of file getf.c.

Referenced by _getf().

#define CF_EXPOK   0x20

Definition at line 96 of file getf.c.

Referenced by _getf().

#define CT_CHAR   0

Definition at line 101 of file getf.c.

Referenced by _getf().

#define CT_STRING   2

Definition at line 102 of file getf.c.

Referenced by _getf().

#define CT_INT   3

Definition at line 103 of file getf.c.

Referenced by _getf().

#define CT_FLOAT   4

Definition at line 104 of file getf.c.

Referenced by _getf().

#define BUF   16

Definition at line 134 of file putf.c.

Referenced by _putf().

#define PADSIZE   16

Definition at line 138 of file putf.c.

#define ALT   0x01

Definition at line 162 of file putf.c.

Referenced by _putf().

#define LADJUST   0x04

Definition at line 163 of file putf.c.

Referenced by _putf().

#define LONGINT   0x08

Definition at line 164 of file putf.c.

Referenced by _putf().

#define ZEROPAD   0x10

Definition at line 165 of file putf.c.

Referenced by _putf().


Typedef Documentation

typedef struct __iobuf FILE

Stream structure type.

A pointer to this type is used for all standard I/O functions to specify a stream.

Note:
Applications should make any assumptions about the contents of this structure as it may change without further notice.

Definition at line 119 of file stdio.h.


Function Documentation

void clearerr ( FILE stream)

Reset error status of a stream.

Parameters:
streamPointer to a previously opened stream.
Note:
This function does nothing.

Definition at line 61 of file clrerr.c.

int fclose ( FILE stream)

Close a stream.

The calling thread may be suspended until all buffered output data has been written.

Parameters:
streamPointer to a previously opened stream.
Returns:
0 if the stream is successfully closed, EOF otherwise.

Definition at line 76 of file fclose.c.

References __iob, _close(), EBADF, EOF, errno, FOPEN_MAX, and free().

Referenced by fcloseall(), main(), NutFtpCloseSession(), NutFtpTransferDirectoryOptions(), NutSmtpDisconnect(), service(), and Service().

Here is the call graph for this function:

void fcloseall ( void  )

Close all open streams.

The standard streams stdin, stdout and stderr are not closed.

The calling thread may be suspended until all buffered output data has been written.

Definition at line 63 of file fcloseall.c.

References __iob, fclose(), and FOPEN_MAX.

Here is the call graph for this function:

FILE* _fdopen ( int  fd,
CONST char *  mode 
)

Open a stream associated with a file, device or socket descriptor.

Parameters:
fdDescriptor of a previously opened file, device or connected socket.
modeSpecifies the access mode.
  • "r" Read only.
  • "w" Write only.
  • "a" Write only at the end of file.
  • "r+" Read and write existing file.
  • "w+" Read and write, destroys existing file contents.
  • "a+" Read and write, preserves existing file contents.
  • "b" May be appended to any of the above strings to specify binary access.
Returns:
A pointer to the open stream or a null pointer to indicate an error.

Definition at line 81 of file fdopen.c.

References __iob, _fmode(), _O_TEXT, ENFILE, ENOMEM, EOF, errno, FOPEN_MAX, and malloc().

Referenced by main(), NutFtpOpenSession(), NutFtpTransferDirectoryOptions(), NutSmtpConnect(), service(), and Service().

Here is the call graph for this function:

int feof ( FILE stream)

Test if a stream reached the end of file.

Parameters:
streamPointer to a previously opened stream.
Returns:
0 if the current position is not the end of the file.

Definition at line 66 of file feof.c.

References _IOEOF, and NUTASSERT.

int ferror ( FILE stream)

Test for an error on a stream.

Parameters:
streamPointer to a previously opened stream.
Returns:
0 if no error occured.

Definition at line 67 of file ferror.c.

References _IOERR, and NUTASSERT.

int fflush ( FILE stream)

Flush a stream.

The calling thread may be suspended until all buffered output data has been written.

Parameters:
streamPointer to a previously opened stream.
Returns:
0 if the buffer was successfully flushed, EOF if an error occured.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 71 of file fflush.c.

References _write(), EOF, and NUTASSERT.

Referenced by _flushall(), main(), NutFtpProcessPassiv(), NutFtpRespondBad(), NutFtpRespondOk(), NutFtpSendMode(), NutFtpServerSession(), NutHttpProcessRequest(), NutSmtpSendCommand(), NutSmtpSendMail(), ProcessRequests(), ShowForm(), and StreamCopy().

Here is the call graph for this function:

int fgetc ( FILE stream)

Read a character from a stream.

Parameters:
streamPointer to a previously opened stream.
Returns:
Character read or EOF to indicate an error or end of file. In the latter case feof() or ferror() can be used to determine the cause of the failure.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 81 of file fgetc.c.

References _IOEOF, _IOERR, _IOUNG, _read(), EOF, and NUTASSERT.

Referenced by fgets(), getc(), getchar(), and gets().

Here is the call graph for this function:

char* fgets ( char *  buffer,
int  count,
FILE stream 
)

Read a line from a stream.

Read at most one less than the specified number of characters from a stream or stop when a newline has been read.

Parameters:
bufferPointer to the buffer that receives the data including the linefeed character.
countMaximum number of characters to read.
streamPointer to a previously opened stream.
Returns:
Pointer to the given buffer or NULL to indicate an error or the end of the file.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 73 of file fgets.c.

References EOF, fgetc(), and NUTASSERT.

Referenced by main(), NutFtpServerSession(), NutHttpProcessRequest(), NutSmtpReceiveResponse(), and ProcessRequests().

Here is the call graph for this function:

int _fileno ( FILE stream)

Get the file descriptor associated with a stream.

In contrast to other implementations, the standard streams stdin, stdout and stderr do not return 0, 1 and 2 resp.

Parameters:
streamPointer to a previously opened stream.
Returns:
The file descriptor.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 70 of file fileno.c.

References NUTASSERT.

Referenced by InitDebugDevice(), kbhit(), main(), syslog_flush(), vfscanf(), and vfscanf_P().

void _flushall ( void  )

Flushes all streams.

Definition at line 60 of file flushall.c.

References __iob, fflush(), and FOPEN_MAX.

Here is the call graph for this function:

int _fmode ( CONST char *  mode)

Definition at line 70 of file fmode.c.

References _O_APPEND, _O_BINARY, _O_CREAT, _O_RDONLY, _O_RDWR, _O_TEXT, _O_TRUNC, _O_WRONLY, EINVAL, EOF, errno, and NUTASSERT.

Referenced by _fdopen(), fopen(), and freopen().

FILE* fopen ( CONST char *  name,
CONST char *  mode 
)

Open a stream.

Parameters:
nameThe name of a registered device, optionally followed by a colon and a filename.
modeSpecifies the access mode.
  • "r" Read only.
  • "w" Write only.
  • "a" Write only at the end of file.
  • "r+" Read and write existing file.
  • "w+" Read and write, destroys existing file contents.
  • "a+" Read and write, preserves existing file contents.
  • "b" May be appended to any of the above strings to specify binary access.
Returns:
A pointer to the open stream or a null pointer to indicate an error.

Definition at line 83 of file fopen.c.

References __iob, _fmode(), _O_TEXT, _open(), ENFILE, EOF, errno, FOPEN_MAX, free(), and malloc().

Referenced by main().

Here is the call graph for this function:

int fprintf ( FILE stream,
CONST char *  fmt,
  ... 
)

Print formatted data to a stream.

Parameters:
streamPointer to a previously opened stream.
fmtFormat string containing conversion specifications.
Returns:
The number of characters written or a negative value to indicate an error.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 68 of file fprintf.c.

References NUTASSERT, and vfprintf().

Referenced by DhcpStateDebug(), DumpDnsHeader(), DumpDnsQuestion(), DumpDnsResource(), main(), NutArpCacheQuery(), NutArpCacheUpdate(), NutChatExpectString(), NutDhcpClient(), NutDhcpIfConfig(), NutDumpIpcp(), NutDumpIpcpOption(), NutDumpLcp(), NutDumpLcpOption(), NutDumpPap(), NutDumpPapOption(), NutDumpPpp(), NutDumpSocketList(), NutDumpTcpHeader(), NutHeapDump(), NutHttpSendHeaderTop(), NutSmtpSendMailHeader(), NutThreadCreate(), PerCiDump(), PhatDbgDirEntry(), PhatDbgFileInfo(), PhatDbgVbr(), Counter::print(), ProcessRequests(), and ShowForm().

Here is the call graph for this function:

int fprintf_P ( FILE stream,
PGM_P  fmt,
  ... 
)

Print formatted data to a stream.

Similar to fprintf() except that the format string is located in program memory.

Parameters:
streamPointer to a previously opened stream.
fmtFormat string in program space containing conversion specifications.
Returns:
The number of bytes written or a negative value to indicate an error.
Warning:
The function will not check, if the stream pointer points to a valid stream.
Do not use this function with a debug device while running in interrupt context.

Definition at line 73 of file fprintf_p.c.

References vfprintf_P().

Here is the call graph for this function:

int fpurge ( FILE stream)

Purge a stream, i.e. discards the input buffer.

Parameters:
streamPointer to a previously opened stream.
Returns:
0 if the buffer was successfully purged, EOF if an error occured.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 66 of file fpurge.c.

References _read(), EOF, and NUTASSERT.

Here is the call graph for this function:

int fputc ( int  c,
FILE stream 
)

Write a character to a stream.

Parameters:
cCharacter to write.
streamPointer to a previously opened stream.
Returns:
The character written or EOF to indicate an error.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 69 of file fputc.c.

References _write(), EOF, and NUTASSERT.

Referenced by DumpDnsResource(), NutArpCacheUpdate(), NutChatExpectString(), NutDumpHeap(), NutDumpPapOption(), NutDumpThreadList(), NutFtpTransferDirectoryOptions(), NutSmtpSendEncodedLines(), PerCiDump(), PhatDbgAttrList(), PhatDbgDirEntry(), putc(), putchar(), puts(), puts_P(), vsyslog(), and vsyslog_P().

Here is the call graph for this function:

int fputs ( CONST char *  string,
FILE stream 
)

Write a string to a stream.

Parameters:
streamPointer to a previously opened stream.
stringString to write.
Returns:
A non-negative value if successful or EOF to indicate an error.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 70 of file fputs.c.

References _write(), NUTASSERT, and strlen().

Referenced by IpcpClose(), IpcpLowerDown(), IpcpLowerUp(), IpcpOpen(), LcpClose(), LcpLowerDown(), LcpLowerUp(), LcpOpen(), main(), NutDumpIpcp(), NutDumpIpcpOption(), NutDumpLcp(), NutDumpLcpOption(), NutDumpPap(), NutDumpPapOption(), NutDumpPpp(), NutDumpSocketList(), NutDumpSockState(), NutDumpTcpHeader(), NutDumpThreadList(), NutDumpThreadQueue(), NutFtpTransferDirectoryOptions(), NutPppInput(), NutPppOutput(), NutSmtpSendCommand(), NutSmtpSendEncodedLines(), NutSmtpSendMail(), PerCiDump(), PhatDbgDirEntry(), ProcessRequests(), puts(), vsyslog(), and vsyslog_P().

Here is the call graph for this function:

int fputs_P ( PGM_P  string,
FILE stream 
)

Write a string from progam memory to a stream.

Similar to fputs() except that the string is located in program space.

Parameters:
streamPointer to a previously opened stream.
stringString in program memory to write.
Returns:
A non-negative value if successful or EOF to indicate an error.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 73 of file fputs_p.c.

References _write_P(), NUTASSERT, and strlen_P.

Here is the call graph for this function:

size_t fread ( void *  buffer,
size_t  size,
size_t  count,
FILE stream 
)

Read data from a stream.

Parameters:
bufferPointer to the buffer that receives the data.
sizeItem size in bytes.
countMaximum number of items to read.
streamPointer to a previously opened stream.
Returns:
The number of full items read, which may be less then the specified number.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 75 of file fread.c.

References _IOEOF, _IOERR, _IOUNG, _read(), and NUTASSERT.

Referenced by main(), NutHttpProcessPostQuery(), and StreamCopy().

Here is the call graph for this function:

FILE* freopen ( CONST char *  name,
CONST char *  mode,
FILE stream 
)

Reassign a stream.

Parameters:
nameThe name of a registered device, optionally followed by a colon and a filename.
modeSpecifies the access mode.
  • "r" Read only.
  • "w" Write only.
  • "a" Write only at the end of file.
  • "r+" Read and write existing file.
  • "w+" Read and write, destroys existing file contents.
  • "a+" Read and write, preserves existing file contents.
  • "b" May be appended to any of the above strings to specify binary access.
streamPointer to a previously opened stream.
Returns:
A pointer to the open stream or a null pointer to indicate an error.

Definition at line 93 of file freopen.c.

References __iob, _fmode(), _O_TEXT, _open(), EBADF, EOF, errno, FOPEN_MAX, free(), and malloc().

Referenced by InitDebugDevice(), and main().

Here is the call graph for this function:

int fscanf ( FILE stream,
CONST char *  fmt,
  ... 
)

Read formatted data from a stream.

Parameters:
streamPointer to a previously opened stream.
fmtFormat string containing conversion specifications.
Returns:
The number of fields successfully converted and assigned. The return value is EOF, if an error occurs or if the end of the stream is reached before the first conversion.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 69 of file fscanf.c.

References NUTASSERT, and vfscanf().

Here is the call graph for this function:

int fscanf_P ( FILE stream,
PGM_P  fmt,
  ... 
)

Read formatted data from a stream.

Similar to fscanf() except that the format string is expected in program space.

Parameters:
streamPointer to a previously opened stream.
fmtFormat string in program space containing conversion specifications.
Returns:
The number of fields successfully converted and assigned. The return value is EOF, if an error occurs or if the end of the stream is reached before the first conversion.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 68 of file fscanf_p.c.

References vfscanf_P().

Here is the call graph for this function:

int fseek ( FILE stream,
long  offset,
int  origin 
)

Move read/write position of a stream.

Parameters:
streamPointer to a previously opened stream.
offsetNumber of bytes from initial position.
originInitial position to seek from.
Returns:
0 if no error occured. -1 on error. Errno is set

Definition at line 70 of file fseek.c.

References _seek(), and NUTASSERT.

Here is the call graph for this function:

long ftell ( FILE stream)

Return the read/write position of a stream.

Parameters:
streamPointer to a previously opened stream.
Returns:
The current position.

Definition at line 68 of file ftell.c.

References _tell(), and NUTASSERT.

Here is the call graph for this function:

size_t fwrite ( CONST void *  data,
size_t  size,
size_t  count,
FILE stream 
)

Write data to a stream.

Parameters:
dataPointer to items to be written.
sizeItem size in bytes.
countNumber of items to write.
streamPointer to a previously opened stream.
Returns:
The number of items written, which may be less than the specified number.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 79 of file fwrite.c.

References _write(), and NUTASSERT.

Referenced by NutHttpProcessAsp(), and StreamCopy().

Here is the call graph for this function:

size_t fwrite_P ( PGM_P  data,
size_t  size,
size_t  count,
FILE stream 
)

Write data from program space to a stream.

Similar to fwrite() except that the data is located in program memory.

Parameters:
dataPointer to items in program space to be written.
sizeItem size in bytes.
countNumber of items to write.
streamPointer to a previously opened stream.
Returns:
The number of items written, which may be less than the specified number.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 73 of file fwrite_p.c.

References _write_P(), and NUTASSERT.

Here is the call graph for this function:

int getc ( FILE stream)

Read a character from a stream.

Same as fgetc().

Parameters:
streamPointer to a previously opened stream.
Returns:
Character read or EOF to indicate an error or end of file.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 66 of file getc.c.

References fgetc().

Here is the call graph for this function:

int getchar ( void  )

Read a character from a standard input.

Returns:
Character read or EOF to indicate an error or end of file.

Definition at line 56 of file getchar.c.

References fgetc(), and stdin.

Referenced by main().

Here is the call graph for this function:

int _getf ( int   _getbint, void *, size_t,
int  fd,
CONST char *  fmt,
va_list  ap 
)

Read formatted data using a given input function.

Parameters:
_getbInput function for reading data.
fdDescriptor of a previously opened file, device or connected socket.
fmtFormat string containing coversion specifications.
apList of pointer arguments.
Returns:
The number of fields successfully converted and assigned. The return value is EOF, if an error occurs or if the end of the stream is reached before the first conversion.

Definition at line 119 of file getf.c.

References CF_DPTOK, CF_EXPOK, CF_LONG, CF_NDIGITS, CF_NZDIGITS, CF_PFXOK, CF_SIGNOK, CF_SUPPRESS, CT_CHAR, CT_FLOAT, CT_INT, CT_STRING, EOF, and strtol().

Referenced by vfscanf(), vfscanf_P(), vsscanf(), and vsscanf_P().

Here is the call graph for this function:

char* gets ( char *  buffer)

Get a line from the standard input stream.

Read characters from a stream until a newline has been read.

Parameters:
bufferPointer to the buffer that receives the line excluding the linefeed character.
Returns:
The given argument on success, 0 otherwise.
Warning:
This function is potentially unsafe, because it may write pass the end of the buffer.

Definition at line 69 of file gets.c.

References EOF, fgetc(), NUTASSERT, and stdin.

Here is the call graph for this function:

int printf ( CONST char *  fmt,
  ... 
)

Print formatted data to the standard output stream.

Parameters:
fmtFormat string containing conversion specifications.
Returns:
The number of characters written or a negative value to indicate an error.

Definition at line 64 of file printf.c.

References NUTASSERT, stdout, and vfprintf().

Here is the call graph for this function:

int printf_P ( PGM_P  fmt,
  ... 
)

Print formatted output to the standard output stream.

Similar to printf() except that the format string is located in program memory.

Parameters:
fmtFormat string in program space containing conversion specifications.
Returns:
The number of characters written or a negative value to indicate an error.
Warning:
Do not use this function with a debug device while running in interrupt context.

Definition at line 70 of file printf_p.c.

References stdout, and vfprintf_P().

Referenced by NutFtpDataConnect(), and NutFtpServerSession().

Here is the call graph for this function:

int putc ( int  c,
FILE stream 
)

Write a character to a stream.

Same as fputc().

Parameters:
cCharacter to write.
streamPointer to a previously opened stream.
Returns:
The character written or EOF to indicate an error.
Warning:
The function will not check, if the stream pointer points to a valid stream.

Definition at line 67 of file putc.c.

References fputc().

Here is the call graph for this function:

int putchar ( int  c)

Write a character to standard output.

Parameters:
cCharacter to write.
Returns:
The character written or EOF to indicate an error.

Definition at line 61 of file putchar.c.

References fputc(), and stdout.

Referenced by ARM_COMMON_Handler_crash(), main(), ptrace_dump_regs(), Thread1(), Thread2(), X12RtcReadRegs(), and X12RtcWrite().

Here is the call graph for this function:

int _putf ( int   _putbint, CONST void *, size_t,
int  fd,
CONST char *  fmt,
va_list  ap 
)

Write formatted data using a given output function.

Parameters:
_putbOutput function for writing data.
fdDescriptor of a previously opened file, device or connected socket.
fmtFormat string containing conversion specifications.
apList of arguments.

Definition at line 178 of file putf.c.

References ALT, BUF, free(), LADJUST, LONGINT, malloc(), memchr(), PGM_P, strcpy(), strcpy_P, strlen(), strlen_P, and ZEROPAD.

Referenced by vfprintf(), vfprintf_P(), vsprintf(), and vsprintf_P().

Here is the call graph for this function:

int puts ( CONST char *  string)

Write a string to stdout.

Parameters:
stringString to write.
Returns:
A non-negative value or EOF to indicate an error.

Definition at line 58 of file puts.c.

References EOF, fputc(), fputs(), and stdout.

Here is the call graph for this function:

int puts_P ( PGM_P  string)

Write a string from program memory to stdout.

Similar to puts() except that the string is located in program memory.

Parameters:
stringString in program memory to write.
Returns:
A non-negative value or EOF to indicate an error.

Definition at line 61 of file puts_p.c.

References EOF, fputc(), fputs_P, and stdout.

Referenced by NutFtpDataConnect(), and NutFtpTransferFile().

Here is the call graph for this function:

int scanf ( CONST char *  fmt,
  ... 
)

Read formatted data from the standard input stream.

Parameters:
fmtFormat string containing conversion specifications.
Returns:
The number of fields successfully converted and assigned. The return value is EOF, ff an error occurs or if the end of the stream is reached before the first conversion.

Definition at line 65 of file scanf.c.

References NUTASSERT, stdin, and vfscanf().

Here is the call graph for this function:

int scanf_P ( PGM_P  fmt,
  ... 
)

Read formatted data from the standard input stream.

Similar to scanf() except that the format string is located in program space.

Parameters:
fmtFormat string containing conversion specifications.
Returns:
The number of fields successfully converted and assigned. The return value is EOF, ff an error occurs or if the end of the stream is reached before the first conversion.

Definition at line 63 of file scanf_p.c.

References stdin, and vfscanf_P().

Here is the call graph for this function:

int sprintf ( char *  buffer,
CONST char *  fmt,
  ... 
)

Write formatted data to a string.

Parameters:
bufferPointer to a buffer that receives the output string.
fmtFormat string containing conversion specifications.
Returns:
The number of characters written or a negative value to indicate an error.

Definition at line 65 of file sprintf.c.

References NUTASSERT, and vsprintf().

Here is the call graph for this function:

int sprintf_P ( char *  buffer,
PGM_P  fmt,
  ... 
)

Write formatted data to a string.

Similar to sprintf() except that the format string is located in program memory.

Parameters:
bufferPointer to a buffer that receives the output string.
fmtFormat string in program space containing conversion specifications.
Returns:
The number of characters written or a negative value to indicate an error.

Definition at line 71 of file sprintf_p.c.

References vsprintf_P().

Here is the call graph for this function:

int sscanf ( CONST char *  string,
CONST char *  fmt,
  ... 
)

Read formatted data from a string.

Parameters:
stringPointer to the string that contains the data.
fmtFormat string containing conversion specifications.
Returns:
The number of fields successfully converted and assigned. The return value is EOF, if an error occurs or if the end of the stream is reached before the first conversion.

Definition at line 61 of file sscanf.c.

References vsscanf().

Here is the call graph for this function:

int sscanf_P ( CONST char *  string,
CONST char *  fmt,
  ... 
)

Read formatted data from a string.

Similar to sscanf() except that the format string is located in program space.

Parameters:
stringPointer to the string that contains the data.
fmtFormat string in program space containing conversion specifications.
Returns:
The number of fields successfully converted and assigned. The return value is EOF, if an error occurs or if the end of the stream is reached before the first conversion.

Definition at line 68 of file sscanf_p.c.

References PGM_P, and vsscanf_P().

Here is the call graph for this function:

int ungetc ( int  c,
FILE stream 
)

Push a character back onto a stream.

Parameters:
cCharacter to push back.
streamPointer to a previously opened stream.
Warning:
Only a single character can be pushed back. Any previously pushed and not yet read character will be lost.

Definition at line 65 of file ungetc.c.

References _IOUNG, EOF, and NUTASSERT.

int vfprintf ( FILE stream,
CONST char *  fmt,
va_list  ap 
)

Write argument list to a stream using a given format.

Parameters:
streamPointer to a previously opened stream.
fmtFormat string containing conversion specifications.
apList of arguments.
Returns:
The number of characters written or a negative value to indicate an error.

Definition at line 68 of file vfprintf.c.

References _putf(), _write(), and NUTASSERT.

Referenced by fprintf(), NUTPANIC(), NutSmtpSendCommand(), printf(), and vsyslog().

Here is the call graph for this function:

int vfprintf_P ( FILE stream,
PGM_P  fmt,
va_list  ap 
)

Write argument list to a stream using a given format.

Similar to vfprintf() except that the format string is located in program memory.

Parameters:
streamPointer to a previously opened stream.
fmtFormat string in program space containing conversion specifications.
apList of arguments.
Returns:
The number of characters written or a negative value to indicate an error.

Definition at line 74 of file vfprintf_p.c.

References _putf(), _write(), memcpy_P, NUTASSERT, NutHeapAlloc, NutHeapFree, and strlen_P.

Referenced by fprintf_P(), printf_P(), and vsyslog_P().

Here is the call graph for this function:

int vfscanf ( FILE stream,
CONST char *  fmt,
va_list  ap 
)

Read formatted data from a stream.

Parameters:
streamPointer to a previously opened stream.
fmtFormat string containing conversion specifications.
apList of pointer arguments.
Returns:
The number of fields successfully converted and assigned. The return value is EOF, if an error occurs or if the end of the stream is reached before the first conversion.

Definition at line 66 of file vfscanf.c.

References _fileno(), _getf(), and _read().

Referenced by fscanf(), and scanf().

Here is the call graph for this function:

int vfscanf_P ( FILE stream,
PGM_P  fmt,
va_list  ap 
)

Read formatted data from a stream.

Similar to vfscanf() except that the format string is located in program space.

Parameters:
streamPointer to a previously opened stream.
fmtFormat string in program space containing conversion specifications.
apList of pointer arguments.
Returns:
The number of fields successfully converted and assigned. The return value is EOF, if an error occurs or if the end of the stream is reached before the first conversion.

Definition at line 73 of file vfscanf_p.c.

References _fileno(), _getf(), _read(), memcpy_P, NutHeapAlloc, NutHeapFree, and strlen_P.

Referenced by fscanf_P(), and scanf_P().

Here is the call graph for this function:

int vsprintf ( char *  buffer,
CONST char *  fmt,
va_list  ap 
)

Write argument list to a string using a given format.

Parameters:
bufferPointer to a buffer that receives the output string.
fmtFormat string containing conversion specifications.
apList of arguments.
Returns:
The number of characters written or a negative value to indicate an error.

Definition at line 83 of file vsprintf.c.

References _putf().

Referenced by PerCiWriteVarList(), sprintf(), and vsyslog().

Here is the call graph for this function:

int vsprintf_P ( char *  buffer,
PGM_P  fmt,
va_list  ap 
)

Write argument list to a string using a given format.

Similar to vsprintf() except that the format string is located in program memory.

Parameters:
bufferPointer to a buffer that receives the output string.
fmtFormat string in program space containing conversion specifications.
apList of arguments.
Returns:
The number of characters written or a negative value to indicate an error.

Definition at line 85 of file vsprintf_p.c.

References _putf(), memcpy_P, NutHeapAlloc, NutHeapFree, and strlen_P.

Referenced by sprintf_P(), and vsyslog_P().

Here is the call graph for this function:

int vsscanf ( CONST char *  string,
CONST char *  fmt,
va_list  ap 
)

Read formatted data from a string.

Parameters:
stringPointer to a string that contains the data.
fmtFormat string containing conversion specifications.
apList of pointer arguments.
Returns:
The number of fields successfully converted and assigned. The return value is EOF, if an error occurs or if the end of the stream is reached before the first conversion.

Definition at line 95 of file vsscanf.c.

References _getf(), and CONST.

Referenced by sscanf().

Here is the call graph for this function:

int vsscanf_P ( CONST char *  string,
PGM_P  fmt,
va_list  ap 
)

Read formatted data from a string.

Similar to vsscanf() except that the format string is located in program space.

Parameters:
stringPointer to a string that contains the data.
fmtFormat string in program space containing conversion specifications.
apList of pointer arguments.
Returns:
The number of fields successfully converted and assigned. The return value is EOF, if an error occurs or if the end of the stream is reached before the first conversion.

Definition at line 97 of file vsscanf_p.c.

References _getf(), CONST, memcpy_P, NutHeapAlloc, NutHeapFree, and strlen_P.

Referenced by sscanf_P().

Here is the call graph for this function:


Variable Documentation

FILE* __iob[]

Definition at line 63 of file fopen.c.

Referenced by _fdopen(), _flushall(), fclose(), fcloseall(), fopen(), and freopen().

FILE* __iob[FOPEN_MAX] = { (FILE *) 1, (FILE *) 2, (FILE *) 3 }

Definition at line 63 of file fopen.c.

Referenced by _fdopen(), _flushall(), fclose(), fcloseall(), fopen(), and freopen().