Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.


Results 1 to 5 of 5

Thread: Data type conversion

  1. #1

    Barcode Data type conversion


    I am trying to split a string depending on the delimiter .

    The function tat splits require a string input so iwas splitting a sample string ,but now i need to split the TCHAR[] , so i thought the better way is to convert TCHAR into string and give it as a input for the function tat splits the string.

    So is there anybody really help me to solve this issue .


  2. #2
    Registered User
    not sure i totally understand your question. I think your trying to convert a char array to a string
    but you could do something like

    char myCharArray[] = "bobs , world, susanna";
    string myString = new string(myCharArray); // I think should work if not try looping through the char[]

    for(int i = 0 ; i < strlen(myCharArray);i++){
    myString += myCharArray[i];

    to convert from string to char*[]
    you can do


  3. #3
    Thanks for the reply .

    but i think it will not serve my purpose

    i will paste the piece of code wat i was trying with
    static TCHAR tcStr[ 1024 ]
    int num = StringUtils::SplitString("hello&hai&how&r&u&","&", results, true);
    the above line splits the String depending on the delimiter '&' .
    but instead of that sample string i need to split tchar----tcstr .
    when iuse tat directly to split it is showing the error,..

    error C2664: 'StringUtils::SplitString' : cannot convert parameter 1 from 'TCHAR [1024]' to 'const std::string &'
    1> Reason: cannot convert from 'TCHAR [1024]' to 'const std::string'

    can u please give me a solution for this.

  4. #4
    hey ..

    anyone there to help me as i want this to be implemented in my project.

  5. #5
    you need to use std::basic_string<TCHAR> instead of std::string.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About kirupa.com Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012