I am using C++ ofstream
to write out a file. I want to set the permissions to be only accessible by the user: 700. In unix; I suppose I can just issue a s
There is no cross-platform way to do this. Windows does not support Unix-style file permissions. In order to do what you want, you'll have to look into creating an access control list for that file, which will let you explicitly define access permissions for users and groups.
An alternative might be to create the file in a directory whose security settings have already been set to exclude everyone but the user.
You can't do it in a cross-platform manner. In Linux, you should use the function chmod(2) instead of using system(2)
to spawn a new shell. On Windows, you'll have to use the various authorization functions to make an ACL (access-control list) with the proper permissions.