[GRASS-dev] Re: Overwrite GRASS raster on Windows

Glynn Clements glynn at gclements.plus.com
Tue Nov 28 18:37:09 EST 2006


Radim Blazek wrote:

> The status after OPEN request in Filemon is 'SHARING'.
> So it seems that CopyFile() can overwrite a file which is used
> by another program. I thought that impossibility to delete
> a file is Windows/NTFS, but it is probably only on application
> level. Interesting.

The documentation for CopyFile() isn't clear on this point, but it may
be that it simply overwrites the contents of the existing file, rather
than replacing the file.

The documentation says:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/copyfile.asp

: bFailIfExists
:     [in] If this parameter is TRUE and the new file specified by
:     lpNewFileName already exists, the function fails. If this
:     parameter is FALSE and the new file already exists, the function
:     overwrites the existing file and succeeds.

The term "overwrites" is ambiguous in this context.

Note that MoveFile() doesn't have an equivalent flag; the
documentation for that says:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/movefile.asp

: pNewFileName
:     [in] Pointer to a null-terminated string that specifies the new
:     name of a file or directory. The new name must not already exist. 

IOW, it appears that MoveFile() is primarily an operation on the
filesystem (analogous to Unix' rename()), while CopyFile() is an
operation on the files themselves (Unix doesn't have any direct
equivalent).

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list