c语言中的exec族函数 ex c语言( 四 )


将长整型数value转换成字符串并返回该字符串,radix为转换时所用基数
char*itoa(int value,char *string,int radix)
将整数value转换成字符串存入string,radix为转换时所用基数
double atof(char *nptr) 将字符串nptr转换成双精度数,并返回这个数,错误返回0
intatoi(char *nptr) 将字符串nptr转换成整型数,并返回这个数,错误返回0
longatol(char *nptr) 将字符串nptr转换成长整型数,并返回这个数,错误返回0
double strtod(char *str,char **endptr)将字符串str转换成双精度数,并返回这个数,
longstrtol(char *str,char **endptr,int base)将字符串str转换成长整型数,
并返回这个数,
inttoascii(int c)返回c相应的ASCII
inttolower(int ch)若ch是大写字母('A'-'Z')返回相应的小写字母('a'-'z')
int_tolower(int ch)返回ch相应的小写字母('a'-'z')
inttoupper(int ch)若ch是小写字母('a'-'z')返回相应的大写字母('A'-'Z')
int_toupper(int ch)返回ch相应的大写字母('A'-'Z')
诊断函数,所在函数库为assert.h、math.h
voidassert(int test) 一个扩展成if语句那样的宏,如果test测试失败,
就显示一个信息并异常终止程序,无返回值
voidperror(char *string) 本函数将显示最近一次的错误信息,格式如下:
字符串string:错误信息
char*strerror(char *str) 本函数返回最近一次的错误信息,格式如下:
字符串str:错误信息
intmatherr(struct exception *e)
用户修改数学错误返回信息函数(没有必要使用)
double _matherr(_mexcep why,char *fun,double *arg1p,
double *arg2p,double retval)
用户修改数学错误返回信息函数(没有必要使用)
C语言函数的进程函数所在函数库为stdlib.h、process.h
void abort() 此函数通过调用具有出口代码3的_exit写一个终止信息于
stderr,并异常终止程序 无返回值
int exec…装入和运行其它程序
int execl( char *pathname,char *arg0,char *arg1,…,char *argn,NULL)
int execle( char *pathname,char *arg0,char *arg1,…,
char *argn,NULL,char *envp[])
int execlp( char *pathname,char *arg0,char *arg1,…,NULL)
int execlpe(char *pathname,char *arg0,char *arg1,…,NULL,char *envp[])
int execv( char *pathname,char *argv[])
int execve( char *pathname,char *argv[],char *envp[])
int execvp( char *pathname,char *argv[])
int execvpe(char *pathname,char *argv[],char *envp[])
exec函数族装入并运行程序pathname,并将参数
arg0(arg1,arg2,argv[],envp[])传递给子程序,出错返回-1
在exec函数族中,后缀l、v、p、e添加到exec后,
所指定的函数将具有某种操作能力
有后缀 p时,函数可以利用DOS的PATH变量查找子程序文件
l时,函数中被传递的参数个数固定
v时,函数中被传递的参数个数不固定
e时,函数传递指定参数envp,允许改变子进程的环境,
无后缀e时,子进程使用当前程序的环境
void _exit(int status)终止当前程序,但不清理现场
void exit(int status) 终止当前程序,关闭所有文件,写缓冲区的输出(等待输出),
并调用任何寄存器的出口函数,无返回值
int spawn…运行子程序
int spawnl( int mode,char *pathname,char *arg0,char *arg1,…,
char *argn,NULL)
int spawnle( int mode,char *pathname,char *arg0,char *arg1,…,
char *argn,NULL,char *envp[])
int spawnlp( int mode,char *pathname,char *arg0,char *arg1,…,
char *argn,NULL)
int spawnlpe(int mode,char *pathname,char *arg0,char *arg1,…,
char *argn,NULL,char *envp[])
int spawnv( int mode,char *pathname,char *argv[])
int spawnve( int mode,char *pathname,char *argv[],char *envp[])
int spawnvp( int mode,char *pathname,char *argv[])
int spawnvpe(int mode,char *pathname,char *argv[],char *envp[])

推荐阅读