CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2002
    Posts
    126

    Question How to i Convert Hex int Value.

    Hi,

    How do i conver the Hex value to Integer value. for example
    i am having the Hexvalue is "1E2EE"( for ex: int 30 = 1E(Hex Value ), int 750 = 2EE(hex vlaue) )

    How do i Conver Hex to Int do that?...

    CString csTemp = "1E2EE";

    how do i convert to Int?...

    any help pl.

    i am using VC++,MFC

    Rajesh. S

  2. #2
    Join Date
    May 2002
    Location
    India but now South Korea
    Posts
    75
    In order to convert a hex number stored in a String as like this


    char str="1E2EE"; <- if this is the value we have

    int val;
    sscanf(str,"%x",&val); <- now val has an integer value taken from the string



    This above code executes in all types of programing methods like MFC / C/C++ . And in the place of str variable in sscanf you can also have a dynamic string variable or type cast a CString object using (LPCSTR)

    Regards
    Nagendra

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured