Re: Protecting Software w/ Software License Keys...
Re: Protecting Software w/ Software License Keys...
- Subject: Re: Protecting Software w/ Software License Keys...
- From: Gibbons Burke <email@hidden>
- Date: Tue, 18 Jun 2002 09:24:00 -0500
At 6:22 AM -0700 6/18/02, Joe Morris wrote:
>
I was thinking a good way to do this would be to base it on the user's username. That way other people could copy it relatively easily, but they'd have to create a new account with that username and switch to that to use it, which would be as deterring as anything is likely to get. :-)
>
>
Anyone know off the top of their head how to get the current user's username progromatically?
The classic UNIX command "whoami" will do the trick, but that has been superceded by the "id" command.
These may be executed using the standard C function "system (char *s)", so:
The following code in the main.c file of a "Standard Tool" application template created in Project Builder shows how it works:
<begin main.c>
#include <stdio.h>
int main (int argc, const char * argv[]) {
printf("%s", system("id -p"));
return 0;
}
<end main.c>
See the man page for the "id" command for the various options. If you just want the string for the user's name, that command is "id -un" which is equivalent to the "whoami" command.
Gibbons Burke
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.