int SetFileHide(const char* szFile, int bHide)
{
int pFile = 0;
unsigned char uRet = 0;
unsigned int attr;
do
{
pFile = open(szFile, O_RDWR | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (pFile < 0)
{
uRet = 1;
break;
}
ioctl(pFile, FAT_IOCTL_GET_ATTRIBUTES, &attr);
if (bHide)
attr |= ATTR_HIDDEN;
else
attr &= ~ATTR_HIDDEN;
ioctl(pFile, FAT_IOCTL_SET_ATTRIBUTES, &attr);
close(pFile);
}while(0);
if (uRet)
{
return uRet;
}
return 0;
}
01-13
1596
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交