开发者

C++/CLI .ToString() returning error

I am a beginner to C++/CLI as I come from a C# background. I am currently writing a wrapper for some native C++ code. I have the following methods:

    void AddToBlockList(System::String^ address)
    {
        char* cAddress = (char*)(void*)Marshal::StringToHGlobalAnsi(address);
        _packetFilter->AddToBlockList(cAddress);
    }

    void AddToBlockList(IPAddress^ address)
    {
        char* cAddress = (char*)(void*)Marshal::StringToHGlobalAnsi(address.ToString());
        _packetFilter->AddToBlockList(cAddress);
    }

...The first method works fine and converts my string into the character array开发者_开发百科. However, the second function with the IPAddress object as the signiture gives me the following error:

error C2228: left of '.ToString' must have class/struct/union

...When I type

? address.ToString() 

...in the command window, the IP Address prints. Not sure where I'm going wrong. Any ideas?


address->ToString() ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜