zoukankan      html  css  js  c++  java
  • NX二次开发-UFUN写入本地文本文档uc4524

     1     NX9+VS2012
     2     
     3     #include <uf.h>
     4     #include <uf_cfi.h>
     5     #include <uf_ui.h>
     6 
     7     using std::string;
     8 
     9 
    10 
    11     UF_initialize();
    12 
    13     //内容1
    14     //读取文本全部内容
    15     //打开本地文本文档
    16     int Chan = uc4504("D:\123.txt", 1, 79);//类型为只读,后缀类型txt为79。帮助有写到,自己去查。
    17 
    18     //读取打开的文本文档
    19     char *Cbuf;
    20     int Num = uc4514a(Chan, &Cbuf);//只能读一行
    21 
    22     UF_UI_open_listing_window();
    23     //循环去读每一行
    24     while ( Num>=0 )
    25     {
    26         //打印
    27         strcat(Cbuf, "
    ");//拼接字符串换行
    28         UF_UI_write_listing_window(Cbuf);
    29         Num = uc4514a(Chan, &Cbuf);
    30     }
    31 
    32     //释放内存
    33     UF_free(Cbuf);
    34 
    35     //关闭文本文档
    36     uc4540(Chan, 0);
    37 
    38 
    39     //=================================================================================
    40 
    41 
    42 
    43     /*
    44         //内容2
    45         //向文本写入内容
    46         //打开本地文本文档
    47         int Chan1 = uc4504("D:\456.txt", 3, 209);//类型为写和替换,后缀类型CPP为209。帮助有写到,自己去查。
    48 
    49     //写入内容
    50     uc4524(Chan1, "Hello,World");
    51 
    52     //关闭文本
    53     uc4540(Chan1, 0);
    54 
    55 
    56     //=================================================================================
    57 
    58 
    59     //内容3
    60     //读取部分内容
    61     //打开txt
    62     int WenJian = uc4504("D:\789.txt", 1, 79);
    63 
    64     //读数据
    65     char *OutDate;
    66     int Date1 = uc4514a(WenJian, &OutDate);
    67 
    68     UF_UI_open_listing_window();
    69     char BufLeft[256], BufRight[256];//左值,右值
    70     while (Date1 >= 0)
    71     {
    72         //提取左右值
    73         string S1 = OutDate;
    74         string Strleft = (S1.substr(0, S1.find(",")));//提取左值
    75         string Strright = (S1.substr(S1.find(",") + 1, S1.find("。")));//提取右值
    76 
    77         //将string类型转换为字符数组
    78         strcpy(BufLeft, Strleft.c_str());
    79         strcpy(BufRight, Strright.c_str());
    80 
    81         //打印
    82         UF_UI_write_listing_window(BufLeft);
    83         UF_UI_write_listing_window("
    ");
    84 
    85         Date1 = uc4514a(WenJian, &OutDate);
    86     }
    87 
    88     //释放内存
    89     UF_free(OutDate);
    90     
    91     //关闭文件
    92     uc4540(WenJian, 0);
    93     */
    94 
    95     UF_terminate();
    96 
    97     Caesar
    98     2018年10月21日

  • 相关阅读:
    Powershell 的自己主动部署
    Python 爬虫批量下载美剧 from 人人影视 HR-HDTV
    c :函数指针具体解释
    云计算设计模式(二十二)——静态内容托管模式
    Bash 脚本 getopts为什么最后一个參数取不到
    清理SYSAUX表空间的WRH$_LATCH_CHILDREN表
    Linux配置防火墙,开启80port、3306port 可能会遇到的小问题
    Android v4包中的 SwipeRefreshLayout 官方的下拉刷新组件
    Nginx 笔记与总结(3)配置虚拟主机
    用SPSS做时间序列
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/11099447.html
Copyright © 2011-2022 走看看