You would use CreateFile() if you just want to rename a file, I see that you are actually trying to make a backup. In this case use CopyFile(), the new name will be the second argument to the function. If you are trying to delete a file you need to have all of the references to it destroyed, this may not be your application though it could be your antivirus running a scan in the background.
1. open a file
2. write the info to the file
3. if it reaches a max size, rename the opened file
4. if the count of the rename file reaches 5 then delete the old backup file
in Unix,
I'm doing unlink and rename.
but in windows same is not happening.
Also when my system is running, in Unix I can delete the log files manually where as in win I'm not able to delete manually.
I've used only open function to create a file and get the handle.
When i try to Unlink or rename a file it is giving me error number 32(used by another process). I want to forcefully rename or delete even multiple process is using the file.
Now kindly tell me how to achive the same behaviour in win.