storing octal value in char variable
Hi
I am trying to write a program that takes in two arguments: one - fle name, two - permissions in octal form (eg. 0644). So far I know that for arguments I use: int main(int argc, char **argv) then, I want to use: mode_t mode = argv[2]; int chmod(const char *pathname, mode_t mode) so my problem is that somehow, I need char argv[2] to store the octal/mode_t value which will need to be assigned to the variable "mode" of type "mode_t". I can't get this to work, please help! Thanks |
Several ways:
Code:
#include <stdlib.h> Code:
#include <stdlib.h> |
All times are GMT -5. The time now is 09:51 PM. |