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 6087203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:50:38+00:00 2026-05-23T11:50:38+00:00

So I’ve created an XML file that will configure an application that has already

  • 0

So I’ve created an XML file that will configure an application that has already been built. Up until now, it was hard-coded with constants that represented offset values in flash memory.

enum {
    MAIN_FLASH_OFFSET      = 0x01000000,
    LOADER_FLASH_OFFSET    = 0x01e00000,
    MICROCODE_FLASH_OFFSET = 0x00060400,
    DRIVER_FLASH_OFFSET    = 0x00100000,
    OTHER_FLASH_OFFSET     = 0x00500000
} ModuleOffsets;

I have modified the application to read from the XML file to configure these offsets based dynamically, based on the graphics card that the user chooses.

In one of my header files, I have added the following to replace the previous enum:

    int MAIN_FLASH_OFFSET;
    int LOADER_FLASH_OFFSET;
    int MICROCODE_FLASH_OFFSET;
    int DRIVER_FLASH_OFFSET;
    int OTHER_FLASH_OFFSET;

Here’s my problem. I am using TinyXML to parse the document. Below is a portion of the XML, and my code where I want to pull in these values. When it tries to pull it in, it is having trouble because GetText() returns a string, and the values (0x01000000, etc…) are ints (at least I think.

So how exactly do I store these? I really have no clue, but I feel like I’m close.

XML (the actual file has multiple card entries)

<EGCs xmlns="http://tempuri.org/XMLSchema.xsd">
  <card type="EGC1">
    <offsets>
      <flashOffset>0x01000000</flashOffset>
      <loaderFlashOffset>0x01e00000</loaderFlashOffset>
      <microFlashOffset>0x00060400</microFlashOffset>
      <driverFlashOffset>0x00100000</driverFlashOffset>
      <otherFlashOffset>0x00500000</otherFlashOffset>
    </offsets>
  </card>
</EGCs>

Code

    COFPFileGeneratorDlg ofp;
    TiXmlDocument doc("EGC_Cards.xml"); 
    if(doc.LoadFile())
    {
        TiXmlHandle hDoc(&doc);
        TiXmlElement *pRoot, *pParm;
        pRoot = doc.FirstChildElement("EGCs");
        if(pRoot)
        {
            pParm = pRoot->FirstChildElement("card");
            while(pParm)
            {
                if(pParm && pParm->Attribute("type") == m_dConfigDlg.m_strEGCType)
                {
                    ofp.MAIN_FLASH_OFFSET = pRoot
                        ->FirstChildElement("card")
                        ->FirstChildElement("flashOffset")
                        ->GetText();

                        [...]
                        // close braces
  • 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-23T11:50:39+00:00Added an answer on May 23, 2026 at 11:50 am

    Convert the string to a string stream and read the value into your integer. Using atoi(abc) would probably work also.

    #include <ios>
    #include <sstream>
    
    int i;
    string abc = "0x001";
    
    stringstream convert ( abc );
    
    convert>> std::hex >> i;
    

    The majority of that code came from a 10 second google search.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I need a function that will clean a strings' special characters. I do NOT
I'm parsing an XML file, the creators of it stuck in a bunch social
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.