CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old July 18th, 2005, 11:09 PM
    QuinnJohns QuinnJohns is offline
    Member
     
    Join Date: Jul 2005
    Location: Louisville, KY
    Posts: 63
    QuinnJohns is on a distinguished road (20+)
    Conversions : Ascii, Hex, ... Octal

    Would I have to write my own macro to do conversions? or are there any prebuilt functions to handle conversions, from Texbox entries.

    -ascii -> ascii
    txtConverTo->Text = txtConvertFrom->Text

    -ascii -> hex
    txtConverTo->Text = hex(txtConvertFrom->Text)
    --- gives
    error C2664: 'std::hex': cannot convert parameter 1 from 'System::String __gc *' to 'std::ios_base &' ------ how would I fix it? please?
    Reply With Quote
      #2    
    Old July 18th, 2005, 11:39 PM
    QuinnJohns QuinnJohns is offline
    Member
     
    Join Date: Jul 2005
    Location: Louisville, KY
    Posts: 63
    QuinnJohns is on a distinguished road (20+)
    Conversion ====================

    How do I convert between :

    ascii binary hex octal --- respectively...
    using Visual C++ .Net?

    hex( ..etc ) doesn't work.

    I'm using two textboxes :
    txtConvertTo and txtConvertFrom ----
    Any Ideas?
    Reply With Quote
      #3    
    Old July 19th, 2005, 04:30 AM
    philkr philkr is offline
    Senior Member
     
    Join Date: Jul 2005
    Location: Germany
    Posts: 1,194
    philkr is a splendid one to behold (750+)philkr is a splendid one to behold (750+)philkr is a splendid one to behold (750+)philkr is a splendid one to behold (750+)philkr is a splendid one to behold (750+)philkr is a splendid one to behold (750+)philkr is a splendid one to behold (750+)
    Re: Conversions : Ascii, Hex, ... Octal

    I don't know if that is what you mean:
    1) atoi
    2) itoa
    __________________
    Please don't forget to rate users who helped you!
    Reply With Quote
      #4    
    Old July 19th, 2005, 05:44 AM
    Andy Tacker Andy Tacker is offline
    More than "Just Another Member"
     
    Join Date: Jun 2001
    Location: 55°50' N 37°39' E
    Posts: 1,503
    Andy Tacker  is a jewel in the rough (300+)Andy Tacker  is a jewel in the rough (300+)Andy Tacker  is a jewel in the rough (300+)Andy Tacker  is a jewel in the rough (300+)
    Re: Conversions : Ascii, Hex, ... Octal

    Look for Format function in STRING class...
    __________________
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.
    Reply With Quote
      #5    
    Old July 20th, 2005, 09:23 AM
    Jinto's Avatar
    Jinto Jinto is offline
    Member
     
    Join Date: Nov 2003
    Location: Seattle, WA
    Posts: 265
    Jinto is on a distinguished road (30+)
    Re: Conversion

    The Managed C++ equal to atoi is Convert::ToInt32( ).

    Code:
    String* str = S"1002";
    int number = Convert::ToInt32( str );
    And back again.

    Code:
    int number = 1002;
    String* str = number.ToString( );
    __________________
    "Lose it? It means go crazy...nuts...insane...bonzo...no longer in possession of one's faculties...3 fries short of a happy meal...WACKO!!!"
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 04:13 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009