Creating a Symbolic link from C++ program

How to create Symbolic link from within a C++ program

Page 1 of 1

2 Replies - 13838 Views - Last Post: 15 November 2010 - 03:44 PM Rate Topic: -----

#1 aelfwyn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 15-November 10

Creating a Symbolic link from C++ program

Posted 15 November 2010 - 03:30 PM

Is there a way to create a Symbolic link from a C++ program without using a system call. Program runs with chmod +s as a privileged user on linux. System call will not honor the chmod +s and executes as the user not the privileged user that owns the program. Don't want to grant permissions to everyone.
Is This A Good Question/Topic? 0
  • +

Replies To: Creating a Symbolic link from C++ program

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6074
  • View blog
  • Posts: 23,540
  • Joined: 23-August 08

Re: Creating a Symbolic link from C++ program

Posted 15 November 2010 - 03:41 PM

man 3 symlink
Was This Post Helpful? 0
  • +
  • -

#3 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: Creating a Symbolic link from C++ program

Posted 15 November 2010 - 03:44 PM

Of course you can create symbolic links. You will need to do so using a platform specific call but the GNU documentation should get you where you need to go.

Google tells me that in #include <unistd.h> there is
int symlink (const char *oldname, const char *newname)

Documentation here

Should not be too hard to figure out.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1