ReactOS 0.4.16-dev-937-g7afcd2a
rename.cpp File Reference
#include <corecrt_internal.h>
#include <io.h>
#include <corecrt_internal_win32_buffer.h>
Include dependency graph for rename.cpp:

Go to the source code of this file.

Functions

int __cdecl rename (char const *const old_name, char const *const new_name)
 

Function Documentation

◆ rename()

int __cdecl rename ( char const *const  old_name,
char const *const  new_name 
)

Definition at line 17 of file rename.cpp.

18{
20
22
23 errno_t cvt1 = __acrt_mbs_to_wcs_cp(old_name, wide_old_name, code_page);
24 if (cvt1 != 0)
25 {
26 errno = cvt1;
27 return -1;
28 }
29
31 errno_t cvt2 = __acrt_mbs_to_wcs_cp(new_name, wide_new_name, code_page);
32 if (cvt2 != 0)
33 {
34 errno = cvt2;
35 return -1;
36 }
37
38 return _wrename(wide_old_name.data(), wide_new_name.data());
39}
_Out_opt_ UINT * code_page
errno_t __acrt_mbs_to_wcs_cp(char const *const null_terminated_input_string, __crt_win32_buffer< wchar_t, ResizePolicy > &win32_buffer, unsigned int const code_page)
unsigned int __acrt_get_utf8_acp_compatibility_codepage()
#define errno
Definition: errno.h:18
_Check_return_ _CRTIMP int __cdecl _wrename(_In_z_ const wchar_t *_NewFilename, _In_z_ const wchar_t *_OldFilename)
errno_t const cvt2
Definition: strftime.cpp:161
errno_t const cvt1
Definition: strftime.cpp:139
int errno_t
Definition: corecrt.h:615