FreeNOS
stdio.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009 Niek Linnenbank
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __LIBC_STDIO_H
19 #define __LIBC_STDIO_H
20 #ifndef __ASSEMBLER__
21 
22 #include <stdarg.h>
23 #include <sys/types.h>
24 #include <Macros.h>
25 
40 #define SEEK_CUR 0
41 
43 #define SEEK_END 1
44 
46 #define SEEK_SET 2
47 
60 typedef struct FILE
61 {
63  int fd;
64 }
65 FILE;
66 
90 extern C FILE * fopen(const char *filename,
91  const char *mode);
92 
121 extern C size_t fread(void *ptr, size_t size,
122  size_t nitems, FILE *stream);
123 
146 extern C size_t fwrite(const void *ptr, size_t size,
147  size_t nitems, FILE *stream);
148 
165 extern C int fclose(FILE *stream);
166 
179 #define dprintf(fmt, ...) \
180  printf("{%s:%d}: " fmt, __FILE__, __LINE__, ##__VA_ARGS__);
181 
192 extern C int snprintf(char *buffer, unsigned int size, const char *fmt, ...);
193 
204 extern C int vsnprintf(char *buffer, unsigned int size, const char *fmt, va_list args);
205 
214 extern C int printf(const char *format, ...);
215 
224 extern C int vprintf(const char *format, va_list args);
225 
231 #endif /* __ASSEMBLER__ */
232 #endif /* __LIBC_STDIO_H */
Macros.h
types.h
fopen
C FILE * fopen(const char *filename, const char *mode)
Open a stream.
Definition: fopen.cpp:24
vsnprintf
C int vsnprintf(char *buffer, unsigned int size, const char *fmt, va_list args)
Write a formatted string into a buffer.
Definition: vsnprintf.cpp:23
fwrite
C size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream)
The fwrite() function shall write, from the array pointed to by ptr, up to nitems elements whose size...
Definition: fwrite.cpp:24
stdarg.h
C
#define C
Used to define external C functions.
Definition: Macros.h:134
printf
C int printf(const char *format,...)
Output a formatted string to standard output.
Definition: printf.cpp:22
va_list
__gnuc_va_list va_list
Definition: stdarg.h:105
FILE::fd
int fd
File descriptor.
Definition: stdio.h:63
vprintf
C int vprintf(const char *format, va_list args)
Output a formatted string to standard output, using a variable argument list.
Definition: vprintf.cpp:23
FILE
struct FILE FILE
A structure containing information about a file.
fread
C size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream)
Binary input.
Definition: fread.cpp:24
FILE
A structure containing information about a file.
Definition: stdio.h:60
fclose
C int fclose(FILE *stream)
Close a stream.
Definition: fclose.cpp:23
snprintf
C int snprintf(char *buffer, unsigned int size, const char *fmt,...)
Write a formatted string into a buffer.
Definition: snprintf.cpp:22