zoukankan      html  css  js  c++  java
  • c# 获取非托管指针长度

    public List<string> GetPDFValues()
            {
                List<string> strs = new List<string>();
                unsafe
                {
                    var len = 0;
                    //调用c++ 返回char**
                    var a = GaussianDistributionServiceProxy.GetPDFValues();
    
                    
    
                    var cx = 0;
    //获取char**指针长度 start
    while (true) { var result = Marshal.PtrToStringAnsi((IntPtr)(*(a + cx))); if (result == null) { len = cx - 1; cx = 0; break; } cx++; }
             
    //获取char**指针长度 end
    //char** 转换为List<string>
    for (int i = 0; i < len; i++)
    {
    string s = Marshal.PtrToStringAnsi((IntPtr)a[i]);
    strs.Add(s); }
    }
    return strs;
    }
  • 相关阅读:
    多态
    抽象类和接口
    面向对象3
    类的继承 设计模式
    面向对象2
    面向对象
    复习
    对json的简单认识
    关于AJAX
    PHP配置开发环境
  • 原文地址:https://www.cnblogs.com/kexb/p/5586945.html
Copyright © 2011-2022 走看看