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

  • Home
  • SEARCH
  • 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 7445081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:43:58+00:00 2026-05-29T11:43:58+00:00

im trying to take std::string value and use it as delimiter in std::getline() function

  • 0

im trying to take std::string value and use it as delimiter in std::getline() function
but no mater what i do the compiler gives me error.
this is what im trying to do :

std::stringstream ss(s);
    std::string item;
    std::string delim ="&&=";
    int ssize = delim.size();
    int newssize = ssize+1;
    char del[SSIZE];  // also here when i try gives error
    strcpy(del,delim.c_str());

        char * delrr[1024] = delim.c_str();  //gives error 

        while(std::getline(ss,item,delrr)) {
           elems.push_back(item);
    }

the error im getting is always about const char* convertion .

 error C2440: 'initializing' : cannot convert from 'const char *' to 'char *[1024]'
1>        There are no conversions to array types, although there are conversions to references or pointers to arrays
1>.\UT.cpp(179) : error C2780: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : expects 2 arguments - 3 provided
1>        d:\Program Files\Microsoft Visual Studio 9.0\VC\include\string(527) : see declaration of 'std::getline'
1>.\UT.cpp(179) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::stringstream'
1>        d:\Program Files\Microsoft Visual Studio 9.0\VC\include\string(475) : see declaration of 'std::getline'
1>.\UT.cpp(179) : error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::stringstream'
1>        d:\Program Files\Microsoft Visual Studio 9.0\VC\include\string(475) : see declaration of 'std::getline'
1>.\UT.cpp(179) : error C2782: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem)' : template parameter '_Elem' is ambiguous
1>        d:\Program Files\Microsoft Visual Studio 9.0\VC\include\string(475) : see declaration of 'std::getline'
1>        could be 'char **'
1>        or       'char'

UPDATE:
found the answer:
How do I tokenize a string in C++?
http://www.codeproject.com/Articles/23198/C-String-Toolkit-StrTk-Tokenizer

  • 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-05-29T11:44:01+00:00Added an answer on May 29, 2026 at 11:44 am

    The third argument of getline() is a char, not a char array. See this. You cannot use this function if you need multiple delimiters or a delimiter made of multiple characters.

    Use find() and substr().

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

Sidebar

Related Questions

I'm trying to take a numeric value in a string and raise it by
I have a datagridview with 9 columns. I am simply trying take the value
I am trying to take the string <BR> in VB.NET and convert it to
I've been trying to take apart this app which creates a search tree based
I'm currently trying to take a string (0.1) and convert it to a double
I'm trying to use git to clone an svn repository with std layout (using
for some reason this code throws an error // map<int, AnItem> roomlist; // map<string,
I'm trying to take a string and then retrieve the required elements from it.
In this program Iam trying to take 78 degrees Fahrenheit and return them in
Im trying to get this program to take the users input and put that

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.