Hi,
I want to create a log file that captures all the actions happening...anyway i got code for that from internet.
Now what i want to do is, make that file read only so that the data is not modified by external application or user.
There's no real easy way to do that. If you really need it to be secure, your best bet is to encrypt it and use some kind of check sum to verify its integrity.
There's no real easy way to do that. If you really need it to be secure, your best bet is to encrypt it and use some kind of check sum to verify its integrity.
thank you......
can you just mention some functions or methods to achieve this....
And then all a user has to do is use explorer, turn off the read only attribute, and do whatever they want to the file. I could be wrong, but I think he needs something more secure than that.
dude.....i want to achieve this using code man.......give me good suggestion
We don't really know what your requirements are and from your OP it seems you're just starting out. It's not a simple topic and you may be getting in over your head. Probably the simplest encryption is just to XOR a bit pattern over your data. There are various checksum algorithms you can use to help ensure the data hasn't been modified by someone other than you. You'll need to decide what your program does if the user deletes your file, or replaces it with an earlier version. Making it really secure won't be easy.
I think people making OP much confuser to find his and.. Do one simple thing..
Make your file normal before reading it by SetFileAttributes (FileName, FILE_ATTRIBUTE_NORMAL) then just before closing your program call the same API with FILE_ATTRIBUTE_HIDDEN.
I think there is no more confusion. Also do the same approach with system() with +r and -r.
I think people making OP much confuser to find his and.. Do one simple thing..
Make your file normal before reading it by SetFileAttributes (FileName, FILE_ATTRIBUTE_NORMAL) then just before closing your program call the same API with FILE_ATTRIBUTE_HIDDEN.
I think there is no more confusion. Also do the same approach with system() with +r and -r.
As has been explained already, all a user has to do is turn off those attributes and they can do what they want with the file. That isn't secure.
I think people making OP much confuser to find his and.. Do one simple thing..
Make your file normal before reading it by SetFileAttributes (FileName, FILE_ATTRIBUTE_NORMAL) then just before closing your program call the same API with FILE_ATTRIBUTE_HIDDEN.
I think there is no more confusion. Also do the same approach with system() with +r and -r.
thank you very much......your suggesstion has solved my problem as of now .......
Bookmarks