LanceDrolet
Programmer
Hi..
A project at school has me reinventing the wheel. I'm required to re-write several linux command line apps using the associated system calls. The problem I'm having is with CHMOD.
It works fine, when I embed the mode I want to change the file to in the code. The problems start when I try using the command line arg. I've tried using "chmod(argv[1], *argv[2]);" but what ends up happening is the permissions get changed to the octal representation of what's typed in for argv[2].
So it seems I need to come up with a way to change the string returned by argv[2] to an octal, or change the int returned by atoi(argv[2]) to an octal.
Any suggestions??
Thanks...
A project at school has me reinventing the wheel. I'm required to re-write several linux command line apps using the associated system calls. The problem I'm having is with CHMOD.
It works fine, when I embed the mode I want to change the file to in the code. The problems start when I try using the command line arg. I've tried using "chmod(argv[1], *argv[2]);" but what ends up happening is the permissions get changed to the octal representation of what's typed in for argv[2].
So it seems I need to come up with a way to change the string returned by argv[2] to an octal, or change the int returned by atoi(argv[2]) to an octal.
Any suggestions??
Thanks...