Re: Make g_rename() replace existing files on Win32?



On 30/11/05 00:54:22, Tor Lillqvist wrote:
The rename() function in the Microsoft C library calls the Win32 API
MoveFile(), which does not replace existing files.

I now notice there is also a function MoveFileEx(), to which one can
specify the flag MOVEFILE_REPLACE_EXISTING, which enables atomic
replacement of an existing file. Sigh, why didn't I notice that
earlier...

What do you think, should g_rename() be changed to use MoveFileEx()
instead of rename() on NT-based Windowses? My vote is yes.

And mine too. The advantages outweigh the tiny API breakage.

Cheers,

Ali.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]