下面是我写的一段打开文件的代码你参考一下:
tag_t UF_open_part()
{
char filter_string[132]="*";
char filename[132];
int response;
int rc=0;
char msg[132];
tag_t part1;
rc=UF_UI_create_filebox("Open File","打开文件",filter_string," ",filename,[$response)]
if(rc)
{
UF_get_fail_message(rc,msg);
printf("error=%s\n",msg);
}
if(response==UF_UI_OK)
{
char partname[132];
UF_PART_load_status_t error_status;
strcpy(partname,filename);
UF_PART_open(partname,[$part1,&error_status)]
if(part1==NULL_TAG)
{
uc1601("打开part错误",1);
UF_PART_close_all();//退出之前关闭所有part
UF_terminate();
}
else
{
UF_PART_save();
UF_PART_set_display_part(part1);
}
}
return part1;
} |