点击查看详细介绍

UF_set_variable() 函数的参数解释说明、函数详细用法,以及实例代码演示

misnn 9年前 1015 0

购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008  QQ号:85585969  


函数结构:
UF_set_variable
(
const char * variable,
const char * value
)

函数说明:
设置一个环境变量值中指定的字符串。 你必须供应变量的完整名称。

函数参数:
第1个参数为输入:
输入const char * 字符类型的参数,参数的变量格式为variable,环境变量在操作系统中设置

第2个参数为输入:
输入const char * 字符类型的参数,参数的变量格式为value,值或可变等价串。

UF_set_variable函数实例代码演示:
[quote]
#include <uf.h>
#include <stdio.h>
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
static int report( char *file, int line, char *call, int irc)
{
if (irc)
{
char messg[133];
printf("%s, line %d: %s\n", file, line, call);
(UF_get_fail_message(irc, messg)) ?
printf(" returned a %d\n", irc) :
printf(" returned error %d: %s\n", irc, messg);
}
return(irc);
}
static void do_ugopen_api(void)
{
char *ptr;


UF_CALL(UF_set_variable("UGII_NEW_VARIABLE", "value"));
UF_CALL(UF_translate_variable("UGII_NEW_VARIABLE", &ptr));
printf("value of UGII_NEW_VARIABLE is : %s\n", ptr);

}
void ufusr(char *param, int *retcode, int paramLen)
{
if (!UF_CALL(UF_initialize()))
{
do_ugopen_api();
UF_CALL(UF_terminate());
}
}
int ufusr_ask_unload(void)
{
return (UF_UNLOAD_IMMEDIATELY);
}

void ufusr_cleanup(void)
{
/* Perform cleanup *
}


[/quote]

0

最新回复 (0)
请登录后发表新帖