char fname[10] = "test.txt";
DWORD dwFileAttributes;
// the following removes the hidden attribute
dwFileAttributes = GetFileAttributes((LPCSTR) fname);
dwFileAttributes &= ~FILE_ATTRIBUTE_HIDDEN;
SetFileAttributes((LPCSTR) fname,dwFileAttributes);
// the following sets the hidden attribute
dwFileAttributes = GetFileAttributes((LPCSTR) fname);
dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN;
SetFileAttributes((LPCSTR) fname,dwFileAttributes);