User Tools

Site Tools


Change file attributes

This code snippet is originally from the former WinAPI site

Sometimes you need to change the file attributes, e.g. if you want to delete a write-protected file. This function solves this problem:

#include <windows.h>
SetFileAttributes (TEXT("C:\\filename.txt"), FILE_ATTRIBUTE_NORMAL);

The possible attributes can be found in the MSDN.

change_fileattributes.txt · Last modified: 2008/06/09 12:37 by christian