From 6d0bf9181121b4c117c80d05a7f097363c531774 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 7 Jun 2009 00:56:23 +0000 Subject: Add Windows CE implementations of some ANSI C functions that are missing. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1553 --- wince/fileops.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 wince/fileops.c (limited to 'wince/fileops.c') diff --git a/wince/fileops.c b/wince/fileops.c new file mode 100644 index 00000000..b0617bd3 --- /dev/null +++ b/wince/fileops.c @@ -0,0 +1,49 @@ +// +// "Extension" implementation of ANSI C file functions for Windows CE. +// +// I (Simon Howard) release this file to the public domain. +// + +#include +#include +#include + +#include + +#include "fileops.h" + +int remove(const char *pathname) +{ + wchar_t temp[MAX_PATH + 1]; + + MultiByteToWideChar(CP_OEMCP, + 0, + pathname, + strlen(pathname) + 1, + temp, + MAX_PATH); + + return DeleteFileW(temp) != 0; +} + +int rename(const char *oldpath, const char *newpath) +{ + wchar_t oldpath1[MAX_PATH + 1]; + wchar_t newpath1[MAX_PATH + 1]; + + MultiByteToWideChar(CP_OEMCP, + 0, + oldpath, + strlen(oldpath) + 1, + oldpath1, + MAX_PATH); + MultiByteToWideChar(CP_OEMCP, + 0, + newpath, + strlen(newpath) + 1, + newpath1, + MAX_PATH); + + return MoveFileW(oldpath1, newpath1); +} + -- cgit v1.2.3