Inet_addr ": Cannot convert parameter 1 from" CString "to" const char * "1>

Source: Internet
Author: User
[CPP] view plaincopy
  1. CString IPAddress;
  2. IPAddress = "192.168.39.207";
  3. DWORD M_dwpuip;
  4. M_dwpuip = inet_addr (ipaddress);

There was an error:
"INET_ADDR": Cannot convert parameter 1 from "CString" to "const char *" 1> there is no user-defined conversion operator available to perform the conversion, or the operator cannot be called.

There's a LPCTSTR on the internet for coercion.

[CPP] view plaincopy
  1. M_dwpuip = inet_addr ((LPCTSTR) ipaddress);

But it's still not working.


Workaround:
Change the < of the project character set using the Unicode character set > to < use multibyte Character set > on it.

Inet_addr ": Cannot convert parameter 1 from" CString "to" const char * "1>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.