马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
在UG中有个函数UF_UI_create_filebox的最后一个参数.
int * response Output UF_UI_OK: OK was selected
UF_UI_CANCEL: CANCEL was selected
我将写入文件名后点"确定"时,生成文件,点"取消"却报错.为何?
char filter_string[132] = "*.txt";
char filename[132];
int response;
int rc = 0;
char msg[132];
FILE *fp;
if ( UF_initialize() != 0)
return ( UF_UI_CB_CONTINUE_DIALOG );
/* ---- Enter your callback code here ----- */
rc =UF_UI_create_filebox (" ",
"My dialog title",
filter_string,
"my_default_name",
filename,
[$response)]
if(rc)
{
UF_get_fail_message(rc, msg);
printf("error = %s\n", msg);
}
if((fp=fopen(filename,"w"))==NULL)
{
printf("can't open file\n\n");
exit(0);
}
fwrite(response,10,1,fp);
fclose(fp); |