getpid是什么函数?

ciahi 2006-12-16 09:50:42
这函数在标准库里面根本没有,还有其他一些函数,在Win-TC中可以用,但是在标准库中找不到
这样的函数是什么函数?
...全文
1927 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
liubingqian 2006-12-18
  • 打赏
  • 举报
回复
这是POSIX的东西,有空看看《UNIX环境高级编程》吧。
gjb999 2006-12-17
  • 打赏
  • 举报
回复
见名知意
lockhall 2006-12-17
  • 打赏
  • 举报
回复
yes

上次看fork()就没想到是在unix下的函数~~~hoho
ciahi 2006-12-17
  • 打赏
  • 举报
回复
#include <stdio.h>
#include <process.h>

void main (void)
{
printf("Process id: %X\n", getpid());
}

这个例子中没有包含unistd.h头文件呀?但是可以正常运行
在Win-TC的库中也没有这个文件

在哪儿可以查看这些函数的定义???
iambic 2006-12-17
  • 打赏
  • 举报
回复
操作系统提供的库函数。
laiwusheng 2006-12-16
  • 打赏
  • 举报
回复
像这样的 见名就可以知义
jixingzhong 2006-12-16
  • 打赏
  • 举报
回复
它不是 标准库中的函数 ...

NAME
getpid - get the process ID
SYNOPSIS
#include <unistd.h>

pid_t getpid(void);


DESCRIPTION
The getpid() function shall return the process ID of the calling process.

RETURN VALUE
The getpid() function shall always be successful and no return value is reserved to indicate an error.

ERRORS
No errors are defined.


--------------------------------------------------------------------------------

The following sections are informative.
EXAMPLES
None.

APPLICATION USAGE
None.

RATIONALE
None.

FUTURE DIRECTIONS
None.

SEE ALSO
exec(), fork(), getpgrp(), getppid(), kill(), setpgid(), setsid(), the Base Definitions volume of IEEE Std 1003.1-2001, <sys/types.h>, <unistd.h>

CHANGE HISTORY
First released in Issue 1. Derived from Issue 1 of the SVID.

Issue 6
In the SYNOPSIS, the optional include of the <sys/types.h> header is removed.

The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:

The requirement to include <sys/types.h> has been removed. Although <sys/types.h> was required for conforming implementations of previous POSIX specifications, it was not required for UNIX applications.
sopro 2006-12-16
  • 打赏
  • 举报
回复
符合POSIX规范的linux/unix必须提供的库函数
返回进程ID

69,370

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧