2008-10-11 07:35:26 -07:00
|
|
|
#ifndef __EVIL_STDIO_H__
|
|
|
|
#define __EVIL_STDIO_H__
|
|
|
|
|
|
|
|
|
2009-10-14 11:48:13 -07:00
|
|
|
/**
|
|
|
|
* @file evil_stdio.h
|
|
|
|
* @brief The file that provides functions ported from Unix in stdio.h.
|
|
|
|
* @defgroup Evil_Stdio_Group Stdio.h functions
|
|
|
|
*
|
|
|
|
* This header provides functions ported from Unix in stdio.h.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2010-02-27 23:57:03 -08:00
|
|
|
#ifdef _WIN32_WCE
|
2008-10-11 07:35:26 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Error related functions
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-01-06 11:32:03 -08:00
|
|
|
EAPI void evil_perror (const char *s);
|
|
|
|
|
|
|
|
# define perror(s) evil_perror(s)
|
2008-10-11 07:35:26 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Stream related functions
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2008-10-24 00:32:08 -07:00
|
|
|
EAPI FILE *evil_fopen(const char *path, const char *mode);
|
|
|
|
|
2008-11-03 23:53:43 -08:00
|
|
|
# define fopen(path, mode) evil_fopen(path, mode)
|
|
|
|
|
2008-11-05 09:27:20 -08:00
|
|
|
EAPI void evil_rewind(FILE *stream);
|
|
|
|
|
2008-12-27 10:53:56 -08:00
|
|
|
# define rewind(f) evil_rewind(f)
|
2008-10-11 07:35:26 -07:00
|
|
|
|
2009-12-19 11:08:28 -08:00
|
|
|
EAPI int evil_remove(const char *path);
|
|
|
|
|
|
|
|
# define remove(p) evil_remove(p)
|
|
|
|
|
2010-02-27 23:57:03 -08:00
|
|
|
#endif /* _WIN32_WCE */
|
2008-10-11 07:35:26 -07:00
|
|
|
|
|
|
|
|
2008-11-09 11:27:13 -08:00
|
|
|
#ifdef _WIN32_WCE
|
|
|
|
|
|
|
|
EAPI FILE *evil_fopen_native(const char *path, const char *mode);
|
|
|
|
|
|
|
|
EAPI size_t evil_fread_native(void* buffer, size_t size, size_t count, FILE* stream);
|
|
|
|
|
|
|
|
EAPI int evil_fclose_native(FILE *stream);
|
|
|
|
|
|
|
|
#endif /* _WIN32_WCE */
|
|
|
|
|
2011-02-04 01:16:11 -08:00
|
|
|
/**
|
|
|
|
* @brief Print allocated string using a va_list.
|
|
|
|
*
|
|
|
|
* @param strp The returned pointer of the allocated string.
|
|
|
|
* @param fmt The format string.
|
|
|
|
* @param ap The variable argument list.
|
|
|
|
* @return -1 on failure, the length of the printed string.
|
|
|
|
*
|
|
|
|
* This function allocates a buffer large enough to hold the output
|
|
|
|
* including the terminating null byte, and return a pointer to it
|
|
|
|
* into @p strp. The format @p fmt is the same than the one used with
|
|
|
|
* printf(). When not needed anymore, the pointer returned in @p strp
|
|
|
|
* must be freed. On error (memory allocation failure or other error),
|
|
|
|
* this function returns -1 and the content of @p strp is undefined,
|
|
|
|
* otherwise it returns the length of the string (not including the
|
|
|
|
* terminating null byte).
|
|
|
|
*
|
|
|
|
* Conformity: GNU extension.
|
|
|
|
*
|
|
|
|
* Supported OS: Windows XP, CE.
|
|
|
|
*/
|
2010-04-14 10:47:40 -07:00
|
|
|
EAPI int vasprintf(char **strp, const char *fmt, va_list ap);
|
|
|
|
|
2011-02-04 01:16:11 -08:00
|
|
|
/**
|
|
|
|
* @brief Print allocated string using a variable number of arguments.
|
|
|
|
*
|
|
|
|
* @param strp The returned pointer of the allocated string.
|
|
|
|
* @param fmt The format string.
|
|
|
|
* @return -1 on failure, the length of the printed string.
|
|
|
|
*
|
|
|
|
* This function allocates a buffer large enough to hold the output
|
|
|
|
* including the terminating null byte, and return a pointer to it
|
|
|
|
* into @p strp. The format @p fmt is the same than the one used with
|
|
|
|
* printf(). When not needed anymore, the pointer returned in @p strp
|
|
|
|
* must be freed. On error (memory allocation failure or other error),
|
|
|
|
* this function returns -1 and the content of @p strp is undefined,
|
|
|
|
* otherwise it returns the length of the string (not including the
|
|
|
|
* terminating null byte).
|
|
|
|
*
|
|
|
|
* Conformity: GNU extension.
|
|
|
|
*
|
|
|
|
* Supported OS: Windows XP, CE.
|
|
|
|
*/
|
|
|
|
EAPI int asprintf(char **strp, const char *fmt, ...);
|
2010-04-14 10:47:40 -07:00
|
|
|
|
2008-11-09 11:27:13 -08:00
|
|
|
|
2009-10-14 11:48:13 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2008-10-11 07:35:26 -07:00
|
|
|
#endif /* __EVIL_STDIO_H__ */
|