文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>一个打印UID GID PID 当前时间 当前目录的程序

一个打印UID GID PID 当前时间 当前目录的程序

时间:2006-06-06  来源:newred

#include <unistd.h>
#include <sys/types.h>
#include <time.h>

pid_t getpid(void);
pid_t getppid(void);

char *getcwd(char *buf, size_t size);
int main(void)
{
    printf("process real     UID:   %d\n", getuid());
    printf("process effect     UID:     %d\n", geteuid());
    printf("process real     GID:   %d\n", getgid());
    printf("process effect     GID:     %d\n", getegid());

    printf("\n");

    printf("process      PID:     %d\n", getpid());
    printf("process     PPID:  %d\n", getppid());    

    printf("\n");

    time_t now;
    time(& now);    /* get time */
    printf("time is:     %s\n",  ctime(&now));   /* ctime() return char string */

    printf("\n");
    
    char buf[512];  
    printf("Current directory: %s\n", getcwd(buf, sizeof(buf)));
   
    return(0);   
}

 
相关阅读 更多 +
排行榜 更多 +
侠盗女孩

侠盗女孩

动作格斗 下载
终极竞速赛

终极竞速赛

动作格斗 下载
活力壁纸

活力壁纸

主题美化 下载