Create a gist now

Instantly share code, notes, and snippets.

fread
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);
char buffer[2048];
while (!feof(pipe)) {
size_t readBytes = fread(buffer, sizeof(buffer[0]), sizeof(buffer) / sizeof(buffer[0]), pipe);
// use buffer here
}
fclose(pipe);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment