Linux / UNIX Tech Support Forum
This is a discussion on set a permission to open a .txt within the Coding in General forums, part of the Development/Scripting category; how I can set a permission to open a .txt file from program in c++ with library <fstream> working from ...
|
|||||||
| Coding in General Discussion on PHP/Perl/Python/Ruby/GNU C or C++. MySQL, PgSQL and (X)HTML or any other programming languages you want. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
| Sponsored Links | ||
|
|
|
||||
|
To change permissions of a file use chmod() or fchmod() under C compiler. You need to include <sys/stat.h>. I've no idea about c++ but these two are used functions under UNIX / Linux oses.
Code:
if ( chmod("/path/to/text.file",0666) == -1 ){
/* error */
}
else{
/* successful */
}
__________________
Vivek Gite Linux Evangelist |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Chmod and Permission.. some on can help me. | hrothgar | Linux software | 2 | 13-01-2009 01:02 AM |
| Slave DNS permission problem | asim.mcp | All about FreeBSD/OpenBSD/NetBSD | 0 | 19-10-2008 07:19 PM |
| How to set folder permission | enochalbert | Ubuntu / Debian | 1 | 25-09-2008 10:19 PM |
| Permission | asim.mcp | Linux software | 1 | 12-08-2006 03:40 AM |
| Permission Problems on WIKI Farm | rcordeiro | Linux software | 5 | 22-06-2006 11:04 PM |