顯示具有 linux 標籤的文章。 顯示所有文章
顯示具有 linux 標籤的文章。 顯示所有文章

2009年9月22日 星期二

search rpm

http://rpm.pbone.net/

2009年9月20日 星期日

pthread example

void *Test(void *threadid)
{
long tid;
tid = (long)threadid;
printf("Hello World! It's me, thread #%ld!\n", tid);
pthread_exit(NULL);
}

int main (int argc, char *argv[])
{
pthread_t myThread;
int rc;
long t;
printf("In main: creating thread %ld\n", t);
rc = pthread_create(&myThread, NULL, Test, (void *)t);
if (rc){
printf("ERROR; return code from pthread_create() is %d\n", rc);
exit(-1);
}
pthread_exit(NULL);
}

2009年9月17日 星期四

set working directory

1. for cocoa
[[NSFileManager defaultManager] changeCurrentDirectoryPath:@"/test"];

2. linux api ( also for mac)
chdir("/test");