]> pd.if.org Git - pdclib/blob - platform/win32/functions/stdio/remove.c
PDCLib includes with quotes, not <>.
[pdclib] / platform / win32 / functions / stdio / remove.c
1 /* remove( const char * )
2
3    This file is part of the Public Domain C Library (PDCLib).
4    Permission is granted to use, modify, and / or redistribute at will.
5 */
6
7 /* This is an example implementation of remove() fit for use with POSIX kernels.
8 */
9
10 #include <stdio.h>
11
12 #ifndef REGTEST
13
14 #include <string.h>
15 #include <errno.h>
16 #include <wchar.h> // Watcom bug: winnt.h assumes string.h defines wchar_t
17 #include <windows.h>
18
19 extern struct _PDCLIB_file_t * _PDCLIB_filelist;
20
21 extern void _PDCLIB_w32errno( void );
22 int remove( const char * pathname )
23 {
24     BOOL ok = DeleteFileA( pathname );
25     if(!ok) {
26         _PDCLIB_w32errno();
27         return -1;
28     } else return 0;
29 }
30
31 #endif
32
33 #ifdef TEST
34 #include "_PDCLIB_test.h"
35
36 int main( void )
37 {
38     /* Testing covered by ftell.c (and several others) */
39     return TEST_RESULTS;
40 }
41
42 #endif
43