]> pd.if.org Git - pdclib/blob - platform/win32/functions/_PDCLIB/_PDCLIB_rename.c
fclose.c: don't try to open testfile2 while already open; [win32] implement rename
[pdclib] / platform / win32 / functions / _PDCLIB / _PDCLIB_rename.c
1 /* $Id$ */
2
3 /* _PDCLIB_rename( const char *, const char * )
4
5    This file is part of the Public Domain C Library (PDCLib).
6    Permission is granted to use, modify, and / or redistribute at will.
7 */
8
9 #include <stdio.h>
10
11 #ifndef REGTEST
12 #include <_PDCLIB_glue.h>
13 #include <errno.h>
14 #include <windows.h>
15
16 void _PDCLIB_w32errno( void );
17 int _PDCLIB_rename( const char * old, const char * new )
18 {
19
20     BOOL ok = MoveFile(old, new);
21     if(!ok) {
22         _PDCLIB_w32errno();
23     }
24     return !ok;
25 }
26
27 #endif
28
29 #ifdef TEST
30 #include <_PDCLIB_test.h>
31
32 #include <stdlib.h>
33
34 int main( void )
35 {
36     return TEST_RESULTS;
37 }
38
39 #endif