summaryrefslogtreecommitdiff
path: root/navit/support/libc/unlink.c
blob: 9e3f9b582edc5c21d9301c14ab87d8bf70fb2f36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * unlink.c: unlink and _unlink implementations for WinCE.
 *
 * This file has no copyright assigned and is placed in the Public Domain.
 * This file is a part of the mingw-runtime package.
 * No warranty is given; refer to the file DISCLAIMER within the package.
 *
 * Written by Pedro Alves <pedro_alves@portugalmail.pt> Feb 2007
 *
 */

#include <stdio.h>
#include <windows.h>

int
_unlink (const char *file)
{
  wchar_t wfile[MAX_PATH];
  size_t conv = mbstowcs (wfile, file, MAX_PATH);
  if (conv > 0 && conv < MAX_PATH && DeleteFileW (wfile))
    return 0;
  return -1;
}

int
unlink (const char *file)
{
  return _unlink (file);
}