Re: How do I access NetInfo from Cocoa?
Re: How do I access NetInfo from Cocoa?
- Subject: Re: How do I access NetInfo from Cocoa?
- From: Rainer Brockerhoff <email@hidden>
- Date: Tue, 9 Oct 2001 14:47:44 -0300
Date: Tue, 9 Oct 2001 09:35:49 -0700
From: Douglas Davidson <email@hidden>
On Monday, October 8, 2001, at 07:01 PM, Josh M. Hurd wrote:
Here is what I came up with:
struct passwd *theUserInfo;
NSString *UID;
theUserInfo = getpwnam([[userName stringValue] cString]);
UID = [[NSNumber numberWithInt:theUserInfo->pw_uid] stringValue];
userName is a user editable TextField.
UID is an NSString because I need it in a pathname.
I would suggest not using the cString method here. Strings at the BSD
level are generally UTF8, so you should probably specify that.
As someone else from Apple pointed out to me, [userName
fileSystemRepresentation] would be more orthodox than [userName
UTF8String] due to encoding subtleties.
--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"Originality is the art of concealing your sources."
http://www.brockerhoff.net/ (updated Oct. 2001)