• 转载:HTuple数据和VC数据的相互赋值


    转载来自:http://blog.csdn.net/taily_duan/article/details/51026260

    HTuple和VC数据的相互赋值

    // HTuple→VC 数据类型转换
    HTuple hTuple = 1234;
    int i = hTuple[0].I();                  // i=1234
    long l = hTuple[0].L();                 // l=1234
    long lNumber = hTuple.Num();            // lNumber=1,数据个数
    double d = hTuple[0].D();               // d=1234.0000
        
    hTuple = "1234";
    CString strBuffer = hTuple[0].S();      // strBuffer="1234"
        
        
    // VC→HTuple 数据类型转换
    int ii = 1234;
    double dd = 1234.1234;
    CString strTemp = "Halcon";
        
    HTuple hTuple2;
    hTuple2[0] = ii;                        // hTuple2[0].I()=1234
    hTuple2[1] = dd;                        // hTuple2[1].D()=1234.1234
    hTuple2[2] = strTemp.GetBuffer();       // hTuple2[2].S()="Halcon"
        
    i = hTuple2[0].I();                     // i=1234
    d = hTuple2[1].D();                     // d=1234.1234
    strBuffer = hTuple2[2].S();             // strBuffer="Halcon"
    lNumber = hTuple2.Num();                // lNumber=3,数据个数

    HTuple类型数据提取  

    从HTuple类型读取数据

    //HTuple有一个元素

    HTuple aa = 120;
    double dd = aa[0].D(); // dd=120.000
    int ii = aa[0].I(); //ii=120
    long ll = aa[0].L(); //ll=120
    Hlong hh = aa[0].L();//hh=120
    long num = aa.Num(); //num =1;
    aa = "120"; //HTuple为字符串时,如果赋值不是字符串,不能调用S()函数
    const char *cc;
    cc = aa[0].S(); //cc[0]='1',cc[1]='2',cc[2]='0'

    //当aa为多元素的数组时

    aa[1] = 230;
    num = aa.Num(); //num =2;
    ii = aa[1].I(); //ii=230   //其他获取数据的方法与上面类似

  • 相关阅读:
    CentOS(RedHat) 6.2 Samba share权限拒绝访问
    Android NDK调试C++源码(转)
    linux du命令: 显示文件、目录大小
    网络游戏的同步
    游戏开发辅助库
    Unity3D 200个插件免费分享
    C#UDP同步实例
    C#UDP(接收和发送源码)源码完整
    C#完整的通信代码(点对点,点对多,同步,异步,UDP,TCP)
    内置函数及匿名函数
  • 原文地址:https://www.cnblogs.com/supercxm/p/8473677.html
Copyright © 2020-2023  润新知