VC隐藏文件和判断文件是否存在计算机等级考试
文章作者 100test 发表时间 2010:01:08 18:38:53
来源 100Test.Com百考试题网
一:隐藏文件。
1.WinExec函数。
该函数执行一个cmd命令,如修改
C:\\Documents and Settings\\eMLab\\Application Data\\test.txt
文件属性为隐藏可以:
CString strFileName =
"C:\\Documents and Settings\\eMLab\\Application Data\\test.txt".
CString strCmd = "attrib h" strFileName.
WinExec(strCmd,0).
attrib修改文件属性, h表示给文件加上隐藏属性。
2.SetFileAttributes函数
原型:BOOL SetFileAttributes(LPCTSTR