I'm using code below, to launch bash command, with Admin Privileges. I need to be able to store output in Array,after to use it. How can I get output?
char *command1= "/usr/bin/dscl";
char *args1[] = {".","-read","/SharePoints/FolderName","directory_path",nil};
FILE *pipe = nil;
err = AuthorizationCreate(nil,
kAuthorizationEmptyEnvironment,
kAuthorizationFlagDefaults,
&authorizationRef);
err = AuthorizationExecuteWithPrivileges(authorizationRef,
command,
kAuthorizationFlagDefaults,
args1,
&pipe);
Output should be folder -Path of some shared folder. How can I get it, and to store in Array?
P.S. In NSTask is possible to do with NSPipe, but here is File type.
Thanks a lot!
Read from the POSIX file handle (
FILE *
) thatAuthorizationExecuteWithPrivileges
returned to you. Don't forget to close it when you're done.