public
Created

fread

  • Download Gist
gistfile1.c
C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
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);

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.