include/stdio.h File Reference

#include <sys/types.h>
#include <stdarg.h>

Include dependency graph for stdio.h:

Go to the source code of this file.

Defines

#define _ABLE_CLIB_STDIO_H   1
#define FILE   FILE_t
 Buffered I/O stream.
#define SEEK_SET   (0)
#define SEEK_CUR   (1)
#define SEEK_END   (2)
#define _IOFBF   0
#define _IOLBF   1
#define _IONBF   2
#define stdin   stdin
#define stdout   stdout
#define stderr   stderr
#define BUFSIZ   128
#define EOF   (-1)
#define L_tmpnam   20
#define P_tmpdir   "(ram0)/tmp"
#define TMP_MAX   238328

Typedefs

typedef struct file_s FILE_t
typedef int(* printf_fn_t )(const char *msg,...)

Functions

char * tmpnam (char *s)
int printf (const char *format,...)
 Write a formatted string to stdout.
int fprintf (FILE *stream, const char *format,...)
 Write a formatted string to a FILE .
int sprintf (char *buffer, const char *format,...)
 Write a formatted string to a buffer.
int snprintf (char *str, size_t size, const char *format,...)
 Write a formatted string to a buffer with a maximum size.
int vprintf (const char *format, va_list ap)
 Write a formatted string to stdout.
int vfprintf (FILE *stream, const char *format, va_list ap)
 Write a formatted string to a FILE .
int vsprintf (char *str, const char *format, va_list ap)
 Write a formatted string to a buffer.
int vsnprintf (char *str, size_t size, const char *format, va_list ap)
 Write a formatted string to a buffer with a maximum size.
void perror (const char *s)
 Write a standard error message to stderr.
void clearerr (FILE *stream)
 Clears the end of file and error flags on a stream.
int feof (FILE *stream)
 Test for the end of file condition.
int ferror (FILE *stream)
 Test for the stream error condition.
int fileno (FILE *stream)
 Obtain the underlying file descriptor of a stream.
size_t fread (void *ptr, size_t size, size_t nmemb, FILE *stream)
 Read from a stream into a buffer.
size_t fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream)
 Write into a stream from a buffer.
int fgetc (FILE *stream)
 Read a character from a stream.
char * fgets (char *s, int size, FILE *stream)
 Read a string from a stream.
int getc (FILE *stream)
 Read a character from a stream.
int getchar (void)
 Read a character from stdin.
char * gets (char *s)
 Read a string from stdin.
int ungetc (int c, FILE *stream)
 Put a character back into a stream.
int fputc (int c, FILE *stream)
 Writes a character to a stream.
int fputs (const char *s, FILE *stream)
 Writes a string to a stream.
int putc (int c, FILE *stream)
 Writes a character to a stream.
int putchar (int c)
 Writes a character to stdout.
int puts (const char *s)
 Writes a string to a stdout.
FILE * fopen (const char *path, const char *mode)
 Open a FILE stream from a filename.
FILE * fdopen (int fildes, const char *mode)
 Open a FILE stream from a file descriptor.
FILE * freopen (const char *path, const char *mode, FILE *stream)
 Reopen a FILE stream from a filename.
int fclose (FILE *stream)
 Close a FILE stream.
FILE * tmpfile (void)
 Create a temporray file stream.
int scanf (const char *format,...)
 Read data from stdin into variables according to a format string.
int fscanf (FILE *stream, const char *format,...)
 Read data from a stream into variables according to a format string.
int sscanf (const char *str, const char *format,...)
 Read data from a string into variables according to a format string.
int vscanf (const char *format, va_list ap)
 Read data from stdin into variables according to a format string.
int vfscanf (FILE *stream, const char *format, va_list ap)
 Read data from a stream into variables according to a format string.
int vsscanf (const char *str, const char *format, va_list ap)
 Read data from a string into variables according to a format string.
int fseek (FILE *stream, long offset, int whence)
 Seek within a file stream to a specified position.
long ftell (FILE *stream)
 Obtain the current position in a stream.
void rewind (FILE *stream)
 Set a stream position to the beginning.
int fgetpos (FILE *stream, fpos_t *pos)
 Get the current position of a stream.
int fsetpos (FILE *stream, fpos_t *pos)
 Set the current position of a stream.
int fflush (FILE *stream)
 Flush any pending writes out of a stream.
int remove (const char *pathname)
 Deletes an object from the filesystem.
void setbuf (FILE *stream, char *buf)
 Set the buffer a stream is using.
void setbuffer (FILE *stream, char *buf, size_t size)
 Set the buffer a stream is using.
void setlinebuf (FILE *stream)
 Set the buffering type a stream is using.
int setvbuf (FILE *stream, char *buf, int mode, size_t size)
 Set the buffer a stream is using.
int rename (const char *oldpath, const char *newpath)
 Rename an object on a filesystem.
FILE * popen (const char *command, const char *type)
 Process i/o.
int pclose (FILE *stream)
 Close process i/o stream.

Variables

FILE * stdin
 Standard input stream.
FILE * stdout
 Standard output stream.
FILE * stderr
 Standard error output stream.


Define Documentation

#define _ABLE_CLIB_STDIO_H   1

#define _IOFBF   0

#define _IOLBF   1

#define _IONBF   2

#define BUFSIZ   128

#define EOF   (-1)

#define FILE   FILE_t

Buffered I/O stream.

#define L_tmpnam   20

#define P_tmpdir   "(ram0)/tmp"

#define SEEK_CUR   (1)

#define SEEK_END   (2)

#define SEEK_SET   (0)

#define stderr   stderr

#define stdin   stdin

#define stdout   stdout

#define TMP_MAX   238328


Typedef Documentation

typedef struct file_s FILE_t

typedef int(* printf_fn_t)(const char *msg,...)


Function Documentation

void clearerr ( FILE *  stream  ) 

Clears the end of file and error flags on a stream.

Parameters:
stream the FILE stream to clear.

int fclose ( FILE *  stream  ) 

Close a FILE stream.

FILE* fdopen ( int  fildes,
const char *  mode 
)

Open a FILE stream from a file descriptor.

int feof ( FILE *  stream  ) 

Test for the end of file condition.

Parameters:
stream the FILE stream to test.
Returns:
0 if the stream is not at the end of file and non zero if it is.

int ferror ( FILE *  stream  ) 

Test for the stream error condition.

Parameters:
stream the FILE stream to test.
Returns:
0 if the stream has no error and non zero if it does.

int fflush ( FILE *  stream  ) 

Flush any pending writes out of a stream.

int fgetc ( FILE *  stream  ) 

Read a character from a stream.

Parameters:
stream The FILE stream to read from.
Returns:
The character read.

int fgetpos ( FILE *  stream,
fpos_t pos 
)

Get the current position of a stream.

See also:
ftell

char* fgets ( char *  s,
int  size,
FILE *  stream 
)

Read a string from a stream.

Parameters:
s Output string.
size maximum length of output string including null terminator.
stream The FILE stream to read from.
Returns:
s on sucess or NULL on error.

int fileno ( FILE *  stream  ) 

Obtain the underlying file descriptor of a stream.

Parameters:
stream the FILE stream to obtain the fd from.
Returns:
The integer file descriptor underlying a stream.

FILE* fopen ( const char *  path,
const char *  mode 
)

Open a FILE stream from a filename.

int fprintf ( FILE *  stream,
const char *  format,
  ... 
)

Write a formatted string to a FILE .

Parameters:
stream The FILE stream to output to.
format The format specifier.
Returns:
The length of the output string.

int fputc ( int  c,
FILE *  stream 
)

Writes a character to a stream.

int fputs ( const char *  s,
FILE *  stream 
)

Writes a string to a stream.

size_t fread ( void *  ptr,
size_t  size,
size_t  nmemb,
FILE *  stream 
)

Read from a stream into a buffer.

Read data from a FILE stream into a buffer, the amount of data read is the product of nmemb and size. The odd calling convention allows for easy record based file input.

See also:
read write feof ferror
Parameters:
ptr The output buffer
size The size of the elements being transfered.
nmemb The number of elements.
stream The FILE stream to read from.
Returns:
The number of elements read, not the number of bytes or zero on error.

FILE* freopen ( const char *  path,
const char *  mode,
FILE *  stream 
)

Reopen a FILE stream from a filename.

int fscanf ( FILE *  stream,
const char *  format,
  ... 
)

Read data from a stream into variables according to a format string.

int fseek ( FILE *  stream,
long  offset,
int  whence 
)

Seek within a file stream to a specified position.

int fsetpos ( FILE *  stream,
fpos_t pos 
)

Set the current position of a stream.

See also:
fseek

long ftell ( FILE *  stream  ) 

Obtain the current position in a stream.

size_t fwrite ( const void *  ptr,
size_t  size,
size_t  nmemb,
FILE *  stream 
)

Write into a stream from a buffer.

Write data to a FILE stream from a buffer, the amount of data read is the product of nmemb and size. The odd calling convention allows for easy record based file input.

See also:
read write feof ferror
Parameters:
ptr The output buffer
size The size of the elements being transfered.
nmemb The number of elements.
stream The FILE stream to write to.
Returns:
The number of elements written, not the number of bytes or zero on error.

int getc ( FILE *  stream  ) 

Read a character from a stream.

Equivalent to fgetc but may be implemented as a macro which evaluates stream more than once.

See also:
fgetc
Parameters:
stream The FILE stream to read from.
Returns:
The character read.

int getchar ( void   ) 

Read a character from stdin.

Equivalent to getc(stdin).

See also:
getc

fgetc

Returns:
The character read.

char* gets ( char *  s  ) 

Read a string from stdin.

Warning:
This call reads an unbounded amount of data into s and will almost certianly represnt a buffer overflow error. Use fgets instead.
Parameters:
s Output string.
Returns:
s on sucess or NULL on error.

int pclose ( FILE *  stream  ) 

Close process i/o stream.

void perror ( const char *  s  ) 

Write a standard error message to stderr.

Display the optional message s followed by a colon, a space and then the system error message. The message is determined by the contents of the external stderr variable.

Parameters:
s The message prefix.

FILE* popen ( const char *  command,
const char *  type 
)

Process i/o.

int printf ( const char *  format,
  ... 
)

Write a formatted string to stdout.

Parameters:
format The format specifier.
... The values depending of the format specifier.
Returns:
The length of the output string.

int putc ( int  c,
FILE *  stream 
)

Writes a character to a stream.

int putchar ( int  c  ) 

Writes a character to stdout.

int puts ( const char *  s  ) 

Writes a string to a stdout.

int remove ( const char *  pathname  ) 

Deletes an object from the filesystem.

int rename ( const char *  oldpath,
const char *  newpath 
)

Rename an object on a filesystem.

void rewind ( FILE *  stream  ) 

Set a stream position to the beginning.

Equivalent to (void) fseek(stream, 0L, SEEK_SET)

int scanf ( const char *  format,
  ... 
)

Read data from stdin into variables according to a format string.

void setbuf ( FILE *  stream,
char *  buf 
)

Set the buffer a stream is using.

Equivalent to setvbuf(stream, buf, buf ? _IOFBF : _IONBF, BUFSIZ);

void setbuffer ( FILE *  stream,
char *  buf,
size_t  size 
)

Set the buffer a stream is using.

void setlinebuf ( FILE *  stream  ) 

Set the buffering type a stream is using.

Equivalent to setvbuf(stream, (char *) NULL, _IOLBF, 0);

int setvbuf ( FILE *  stream,
char *  buf,
int  mode,
size_t  size 
)

Set the buffer a stream is using.

int snprintf ( char *  str,
size_t  size,
const char *  format,
  ... 
)

Write a formatted string to a buffer with a maximum size.

Parameters:
str The buffer in which to place the output.
size The size of the str buffer,
format The format specifier.
Returns:
The length of the output string.

int sprintf ( char *  buffer,
const char *  format,
  ... 
)

Write a formatted string to a buffer.

Warning:
This call is unsafe as the output is unbounded. The snprintf function should be used in preference.
Parameters:
buffer The buffer in which to place the output.
format The format specifier.
Returns:
The length of the output string.

int sscanf ( const char *  str,
const char *  format,
  ... 
)

Read data from a string into variables according to a format string.

FILE* tmpfile ( void   ) 

Create a temporray file stream.

Opens a unique temporary file in binary read/write mode. The file will be automatically deleted when it is closed or the program terminates.

char* tmpnam ( char *  s  ) 

int ungetc ( int  c,
FILE *  stream 
)

Put a character back into a stream.

Parameters:
c The character.
stream The FILE stream to place the character into.

int vfprintf ( FILE *  stream,
const char *  format,
va_list  ap 
)

Write a formatted string to a FILE .

Parameters:
stream The FILE stream to output to.
format The format specifier.
ap The values depending of the format specifier.
Returns:
The length of the output string.

int vfscanf ( FILE *  stream,
const char *  format,
va_list  ap 
)

Read data from a stream into variables according to a format string.

int vprintf ( const char *  format,
va_list  ap 
)

Write a formatted string to stdout.

Parameters:
format The format specifier.
ap The values depending of the format specifier.
Returns:
The length of the output string.

int vscanf ( const char *  format,
va_list  ap 
)

Read data from stdin into variables according to a format string.

int vsnprintf ( char *  str,
size_t  size,
const char *  format,
va_list  ap 
)

Write a formatted string to a buffer with a maximum size.

Parameters:
str The buffer in which to place the output.
size The size of the str buffer,
format The format specifier.
ap The values depending of the format specifier.
Returns:
The length of the output string.

int vsprintf ( char *  str,
const char *  format,
va_list  ap 
)

Write a formatted string to a buffer.

Warning:
This call is unsafe as the output is unbounded. The snprintf function should be used in preference.
Parameters:
str The buffer in which to place the output.
format The format specifier.
ap The values depending of the format specifier.
Returns:
The length of the output string.

int vsscanf ( const char *  str,
const char *  format,
va_list  ap 
)

Read data from a string into variables according to a format string.


Variable Documentation

FILE* stderr

Standard error output stream.

FILE* stdin

Standard input stream.

FILE* stdout

Standard output stream.


Generated on Tue Jan 20 14:28:58 2009 for ABLE LIBC by  doxygen 1.5.6