How to use to_string() from bitset.h

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tadzio

    How to use to_string() from bitset.h

    Hi all !

    I have code:
    bitset<10> w(string("11111 10000"));
    and i want to put in on Edit1->Text
    Edit1->Text=w; // don't works and i don't know how to convert w to
    AnsiString

    Please help me.
    Filip Kasperkiewicz


  • Thomas Matthews

    #2
    Re: How to use to_string() from bitset.h

    Tadzio wrote:[color=blue]
    > Hi all !
    >
    > I have code:
    > bitset<10> w(string("11111 10000"));
    > and i want to put in on Edit1->Text
    > Edit1->Text=w; // don't works and i don't know how to convert w to
    > AnsiString
    >
    > Please help me.
    > Filip Kasperkiewicz
    >[/color]

    FYI, AnsiString is a Borland invention, that causes
    me great stress. For more information, consult your
    Borland documentation (i.e. the help file) or a
    Borland Newsgroup.

    <Off-Topic>
    One nice feature of the AnsiString is that it has
    a constructor that takes a C-style string (array
    of char). The array of character is the vehicle
    used to convert between std::string and AnsiString.

    Let us have:
    AnsiString borland_string;
    std::string cpp_string;

    From std::string to AnsiString:
    borland_string = AnsiString(cpp_ string.c_str()) ;

    From AnsiString to std::string:
    cpp_string = borland_string. c_str();

    Life would be much better if Borland had a
    constructor in AnsiString to create from a std::string.
    A method for producing an std::string from an
    AnsiString would be another benefit. But these
    seem to be just dreams. After all, doesn't
    everybody use AnsiString when programming with
    the Borland compiler? <sarcasm>
    </Off-Topic>



    --
    Thomas Matthews

    C++ newsgroup welcome message:

    C++ Faq: http://www.parashift.com/c++-faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.l earn.c-c++ faq:

    Other sites:
    http://www.josuttis.com -- C++ STL Library book

    Comment

    • Tadzio

      #3
      Re: How to use to_string() from bitset.h

      Great THANKS from POLAND !!!:)

      You helped me. I use now c_str() to convert and everything works.
      Maybe you know some exaples of apply bitset.h class (i write licence form
      computer science about it)
      I will be thankful for that information.

      Filip Kasperkiewicz
      III year of computer science
      University of Maria Curie Sklodowska
      [color=blue]
      >[/color]

      Comment

      Working...