Does anyone know how to make a file hidden? I am using Dev-C++ and WinXP SP2.
Does anyone know how to make a file hidden? I am using Dev-C++ and WinXP SP2.
Hidden from what or who? Are you referring to the windows file attribute?
Yes. It is a sensitive file that I do not want to normal user to see.
Perhaps SetFileAttributes will do what you want, although this is more of a Windows specific question.
Sorry about the windows thing, I didn't know if there was a platform independent solution (which I would love). However, SetFileAttributes worked perfectly for me on windows. Unfortunately, the goal was to be as platform independent as possible (my GUI is using wxWidgets) but ah well.
Try posting this on the windows board, like daved said you may get more information
No. Let it stay here. Hopefully some moderator will move it. Regardless, if you need a platform independent solution, you have one with boost::filesystem
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.
Does boost::filesystem have something like a hidden attribute?
Hmm... I honestly don't know. It lets you extract data like last modified date...
But file attributes may be an entire different game.
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.
I don't think it does. The reason I didn't put this on Windows is that I am looking for a platform independent solution, not one that only works on Windows.
Umm...as I just said my question was not supposed to be windows specific.
Thank you
> Unfortunately, the goal was to be as platform independent as possible (my GUI is using wxWidgets) but ah well.
So you end up with two small files in the corner of your whole project labelled
horridWindowsHacks.c
horridLinuxHacks.c
Both provide an interface like
myProtectFile ( const char *filename );
The windows one implements it using SetFileAttributes
The Linux one implements it using rename or chmod
That is, you achieve the portability by concentrating all the non-portable code into as small a place as possible.
> Does anyone know how to make a file hidden?
Hidden from whom?
If it's from yourself in normal file lists, then making it hidden on windows, or making the first letter of the filename a '.' on unix is one way to go.
If it's from everyone else, then you need to set the read/write ownership to "user only". That would be chmod on unix, but I've no idea what windows would use.
Are you setting the permissions before or after you've filled the file with sensitive information?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
>> It is a sensitive file that I do not want to normal user to see.
I would suggest encrypting it then. Perhaps both 'hide' it and encrypt it.