Pregunta

When I copy a file with CopyFile, will the source file be locked in any way? Say - if the copy operation starts, and then someone wants to open the source file, will it succeed? What if the "someone" requests exclusive access to the file, will his Win32 API call (probably a CreateFile) fail, or will it wait (or whatever) until the copy operation is done?

¿Fue útil?

Solución

If somebody requests exclusive access to a file that's already opened, that request will fail. Windows does not have a file open mode that consists of, "If somebody else is using the file, bump him off."

As I recall, CopyFile opens the source file so that others can read, but not write it.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top