setenv的文档 [英] Documentation for setenv

查看:252
本文介绍了setenv的文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个项目,需要我为我的课程做一些文件,我决定选择setenv,这不是垃圾邮件,所以请不要这样做,但有人可以告诉我,如果这是一个很好的文档,如果不是我应该改变它。



谢谢



Setenv系统调用



此文件将包含有关setenv的信息。



setenv:



手册页



要使用此系统调用,请确保包含以下库



#include< stdlib.h>



参数如下: / p>

int setenv(const char * name,const char * value,int overwrite);



int unsetenv(const char * name);



描述

setenv()系统调用的主要目的是根据传入的值更改名称,
覆盖参数有帮助。同样重要的是要注意,code> setenv()函数是在调用进程的环境中更新或添加
一个变量。覆盖参数取零或非零变量。
如果变量是非零,那么它检查环境中是否存在名称,如果不是,则更改
的值名称的值。如果覆盖 paramater为零,则$ code> name 的值为
未更改。



返回值

成功时, setenv()函数返回零, 1错误,errno设置为指示错误的原因。



示例

char指针变量pPath



pPath = / class / classes / username / homefolder



PWD= / class / classes / username / homefolder / folder1



然后该函数调用如下:



setenv(PWD,pPath,1);



PWD的值更改为 / class / classes / username / homefolder



setenv(PWD,pPath,0);



更改任何内容并将PWD的值保留为 / class / classes / username / homefolder

解决方案

太多的绒毛,一些拼写错误和实际的错误。所有这三个都将被标记。例如:


要使用此系统调用确保包含以下文件:



参数参数



主要目的setenv()系统调用是根据传递的值来更改名称,覆盖参数在那里进行帮助。还要注意, setenv()函数是在更新或添加更新或在调用进程的环境中添加一个变量。




如果覆盖为零或非零,则说明如果两种情况都不正确。


I'm doing a project which requires me to do some documentation for my class and I decided on picking setenv, this is not a spam, so please don't mark it as that, but can someone tell me if this is a good enough documentation and if not what I should change in it.

Thank you

Setenv System Call

This file will include information pertaining to 'setenv'.

setenv:

man page

To use this system call make sure to include the following library

#include <stdlib.h>

The paramaters are as follows:

int setenv(const char *name, const char *value, int overwrite);

int unsetenv(const char *name);

Description

The main purpose of the setenv() system call is to change the name based on the value that is passed in, with the overwrite paramater there to help. Also important to note that setenv() function is there to update or add a variable in the environment of the calling process. The overwrite paramater take a zero or a non-zero variable. If the variable is a non-zero then it checks if the name is there in the environment, if it's not then it changes the value of name to be the value of value. If theoverwrite paramater is a zero then the value of name is not changed.

Return Value

The setenv() function returns zero on success, or -1 on error, with errno set to indicate the cause of the error.

Example

A char pointer variable pPath

pPath = /class/classes/username/homefolder

"PWD" = /class/classes/username/homefolder/folder1

Then the function is called as follows:

setenv("PWD",pPath,1);

Changes the value of "PWD" to be /class/classes/username/homefolder

setenv("PWD",pPath,0);

Does not change anything and leaves the value of "PWD" to be /class/classes/username/homefolder

解决方案

Too much fluff, some spelling errors, and actual mistakes. You will get marked down for all three. For example:

To use this system call make sure to include the following libraryfile:

paramatersparameters

The main purpose of the setenv() system call is to change the name based on the value that is passed in, with the overwrite paramater there to help. Also important to note that setenv() function is there to update or add updates or adds a variable in the environment of the calling process.

Your description of what happens if overwrite is zero or non-zero is incorrect in both cases.

这篇关于setenv的文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆