Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7896431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:53:35+00:00 2026-06-03T07:53:35+00:00

I am running Openipmp client on windows on MS visual studio 2005. Though according

  • 0

I am running Openipmp client on windows on MS visual studio 2005. Though according to document it was tested only on visual studio 6 and MS visual studio .NET.

when i am compiling DRMPlugin, one piece of code giving error

error C2440: '<function-style-cast>' : cannot convert from 'const char *'
to 'std::_String_const_iterator<_Elem,_Traits,_Alloc>'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Alloc=std::allocator<char>
        ]
        No constructor could take the source type, or constructor overload resolution was    ambiguous

Here is the code

bool OpenIPMPDOIContentInfoManager::ParseHostIPPort(const std::string& hostURL,
    std::string& hostIP, int& hostPort) {
  const char* colon = strchr(hostURL.data(), ':');
  if (colon == NULL) {
    return false;
  }
  hostIP = std::string(hostURL.begin(), std::string::const_iterator(colon));
  hostPort = atoi(++colon);
  return true;
}

Can somebody tell me what is wrong with the code.

Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:53:37+00:00Added an answer on June 3, 2026 at 7:53 am
    hostIP = std::string(hostURL.begin(), std::string::const_iterator(colon));
    

    You cannot create a std::string::const_iterator from a pointer to a character. You should not try to mix C style string functions strchr with C++ style std::string as they don’t mix well. Use std::string::find to locate the : and then std::string::substr to create the hostIP or else, use std::find (algorithm) to get an iterator into the : inside the string and use your current constructor.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Running Win7 (machine was delivered with it) and Visual Studio 2008 (ver 9.0.21022.8 RTM).
-- Running within ASP.NET MVC alongside jQuery -- I'm using jQuery to render a
Running Windows PHP 4.4.2 \cli\php.exe fails with an error Cannot find php4ts.dll if the
Running IIS 6 with a main website using .net 4. I have many sub
Running an ASP.Net website and using TinyMCE for content management. Users need to be
Running Apache httpd on Windows, what is the usual method / tool to update
Running the following code on Windows 7 x64 #include <stdio.h> #include <errno.h> int main()
Running MS SqlServer from ASP.NET I have a visitors table with no unique key.
Running Excel 2010 with PowerPivot 10.50.1747.0, accessing SQL Server 2005 SP2. I am modifying
Running sql server 2005 I have database A. I am trying to restore from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.