pwd = getpwnam("bozo");
assert(pwd != NULL);
output_uid = pwd->pw_uid;
output_gid = pwd->pw_gid;
cout << "writing files as " << WRITTEN_FILES_OWNER << " (uid: " << output_uid << ")" << endl;
root can change owndership, we indicate we won't try to change ownership with -1.)
result = chown(filename, -1, output_gid);
-- MattWalsh - 12 Feb 2006