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
1648
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)