I use the code below to run the bash command with administrator privileges. I need to be able to store the output in an array after using it. How can I get the result?
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);
The output should be a folder - The path of any shared folder. How can I get it and save in an array?
PS In NSTask can be done with NSPipe, but here is the file type.
Thank you so much!
source
share