NX9+VS2012

#include <uf.h>
#include <uf_cfi.h>
#include <uf_ui.h> using std::string; UF_initialize(); //内容1
//读取文本全部内容
//打开本地文本文档
int Chan = uc4504("D:\\123.txt", , );//类型为只读,后缀类型txt为79。帮助有写到,自己去查。 //读取打开的文本文档
char *Cbuf;
int Num = uc4514a(Chan, &Cbuf);//只能读一行 UF_UI_open_listing_window();
//循环去读每一行
while ( Num>= )
{
//打印
strcat(Cbuf, "\n");//拼接字符串换行
UF_UI_write_listing_window(Cbuf);
Num = uc4514a(Chan, &Cbuf);
} //释放内存
UF_free(Cbuf); //关闭文本文档
uc4540(Chan, ); //================================================================================= /*
//内容2
//向文本写入内容
//打开本地文本文档
int Chan1 = uc4504("D:\\456.txt", 3, 209);//类型为写和替换,后缀类型CPP为209。帮助有写到,自己去查。 //写入内容
uc4524(Chan1, "Hello,World"); //关闭文本
uc4540(Chan1, 0); //================================================================================= //内容3
//读取部分内容
//打开txt
int WenJian = uc4504("D:\\789.txt", 1, 79); //读数据
char *OutDate;
int Date1 = uc4514a(WenJian, &OutDate); UF_UI_open_listing_window();
char BufLeft[256], BufRight[256];//左值,右值
while (Date1 >= 0)
{
//提取左右值
string S1 = OutDate;
string Strleft = (S1.substr(0, S1.find(",")));//提取左值
string Strright = (S1.substr(S1.find(",") + 1, S1.find("。")));//提取右值 //将string类型转换为字符数组
strcpy(BufLeft, Strleft.c_str());
strcpy(BufRight, Strright.c_str()); //打印
UF_UI_write_listing_window(BufLeft);
UF_UI_write_listing_window("\n"); Date1 = uc4514a(WenJian, &OutDate);
} //释放内存
UF_free(OutDate); //关闭文件
uc4540(WenJian, 0);
*/ UF_terminate(); Caesar
2018年10月21日

NX二次开发-UFUN打开本地文本文档uc4504-LMLPHPNX二次开发-UFUN打开本地文本文档uc4504-LMLPHPNX二次开发-UFUN打开本地文本文档uc4504-LMLPHP

老函数uc4514

     //读取文本全部内容
//打开本地文本文档
int ioChannelNum = uc4504("C:\\PS_List\\List.txt", , ); //读取打开的文本文档
char readBuf[];
int readLen = uc4514(ioChannelNum, readBuf);//只能读一行 UF_UI_open_listing_window(); //循环去读每一行
while ( readLen>= )
{
//打印
strcat(readBuf, "\n");//拼接字符串换行
UF_UI_write_listing_window(readBuf);
readLen = uc4514(ioChannelNum, readBuf);
} //关闭文本文档
uc4540(ioChannelNum, );
05-08 14:55