Skip to content

Instantly share code, notes, and snippets.

@radeks
Created October 12, 2011 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radeks/1281162 to your computer and use it in GitHub Desktop.
Save radeks/1281162 to your computer and use it in GitHub Desktop.
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