mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-02 01:07:25 +00:00
2f766553e8
DOES NOT WORK YET
31 lines
1.6 KiB
C
31 lines
1.6 KiB
C
/* Glue functions for the minIni library, based on the C/C++ stdio library
|
|
*
|
|
* Or better said: this file contains macros that maps the function interface
|
|
* used by minIni to the standard C/C++ file I/O functions.
|
|
*
|
|
* By CompuPhase, 2008-2014
|
|
* This "glue file" is in the public domain. It is distributed without
|
|
* warranties or conditions of any kind, either express or implied.
|
|
*/
|
|
|
|
/* map required file I/O types and functions to the standard C library */
|
|
#include <stdio.h>
|
|
|
|
#define INI_FILETYPE FILE*
|
|
#define ini_openread(filename,file) ((*(file) = _tfopen((filename), __T("rb"))) != NULL)
|
|
#define ini_openwrite(filename,file) ((*(file) = _tfopen((filename), __T("wb"))) != NULL)
|
|
#define ini_openrewrite(filename,file) ((*(file) = _tfopen((filename), __T("r+b"))) != NULL)
|
|
#define ini_close(file) (fclose(*(file)) == 0)
|
|
#define ini_read(buffer,size,file) (_fgetts((buffer),(size),*(file)) != NULL)
|
|
#define ini_write(buffer,file) (_fputts((buffer),*(file)) >= 0)
|
|
#define ini_rename(source,dest) (_trename((source), (dest)) == 0)
|
|
#define ini_remove(filename) (_tremove(filename) == 0)
|
|
|
|
#define INI_FILEPOS long int
|
|
#define ini_tell(file,pos) (*(pos) = ftell(*(file)))
|
|
#define ini_seek(file,pos) (fseek(*(file), *(pos), SEEK_SET) == 0)
|
|
|
|
/* for floating-point support, define additional types and functions */
|
|
#define INI_REAL float
|
|
#define ini_ftoa(string,value) _stprintf((string), __T("%f"),(value))
|
|
#define ini_atof(string) (INI_REAL)_tcstod((string),NULL)
|