PDA

View Full Version : Creating hidden file in Qt on Windows



kremuwa
19th July 2010, 21:14
I'd like to create a hidden file, or create a file and then set it as hidden. Is it possible with Qt or will I need some other libraries? I read QFile, QDir and QFileInfo documentation and - at the first sight - didn't find anything interesting.

squidge
19th July 2010, 23:01
By default, Linux will hide files and dirs that start with a period '.' unless you request them to be listed.

On Windows, try SetFileAttributes(fileName, FILE_ATTRIBUTE_HIDDEN); (http://msdn.microsoft.com/en-us/library/aa365535%28VS.85%29.aspx)

Do note however that both OS's only hide by default. Showing hidden files is a simple menu option.

kremuwa
20th July 2010, 23:29
Thank you for your response, it was very helpful.