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

  • SEARCH
  • Home
  • 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 8307217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:28:57+00:00 2026-06-08T18:28:57+00:00

I have the following code snippet in which I’m trying to print some statements

  • 0

I have the following code snippet in which I’m trying to print some statements into an XML file:

void parseXML::writeStruct(std::fstream& abc,std::string prnt)
{
    for (map<string,struct structSet>::iterator it = structData.begin();it != structData.end();it++)
    {
      if (((it->second.parent.compare("")==0) && (it->second.written == false)))
      {
        bool write = true;
        if (it->second.type.compare("")==0)
        {
            for (set<std::string>::iterator i = it->second.fields.begin(); i != it->second.fields.end(); i++)
            {
                map<string,struct fieldSet>::iterator fd = fieldData.find(*i);
                if (fd != fieldData.end())
                {
                    std::string type = fd->second.type;
                    map<string,struct structSet>::iterator ntC = structData.find(type);
                    if (ntC != structData.end())
                    {
                        if (ntC->second.type.compare("") != 0)
                        {
                           map<string,struct structSet>::iterator ntC = structData.find(ntC->second.type);
                           if (ntC == structData.end()|| ntC->second.type.compare("")!= 0||ntC->second.written == false)
                           {  
                              continue;
                           }

                        }
                        else
                        {
                            map<string,struct structSet>::iterator ntC = structData.find(ntC->second.type);
                            if (ntC->second.parent.compare(it->second.name))
                            {
                            }
                            else if (ntC->second.written == true)
                            {
                                abc << INDENT << "\t" <<"\t" << "<nonterminal ref= \"" << ntC->second.name.c_str() << "\">" << std::endl;
                                abc << INDENT << "\t" << "\t" <<"\t" << "<name>" << fd->second.name.c_str() << "</name>" << std::endl;
                                abc << INDENT << "\t"<< "\t" << "</nonterminal >" << std::endl;
                            }
                        }
                    }

The problem is that it is not executing the first for loop:

for (map<string,struct structSet>::iterator it = structData.begin(); it != structData.end(); it++)

What are the possible reasons for this?

  • 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-06-08T18:28:58+00:00Added an answer on June 8, 2026 at 6:28 pm

    Here is a (hopefully) full list, sorry for the obvious entries, but we have no idea how experienced you are:

    • structData is empty
    • structData is corrupted, which crashes the application
    • parseXML::writeStruct was never executed
    • the for loop got executed, but the following (if, for) conditionals failed, and you interpreted this wrongly.

    Pick a debugger or add trace messages (don’t forget to use endl as output is typically line buffered and will be lost in case of a crash).

    Note: post only the relevant part of the code, the rest of it is just noise for us (unless you want a code review for which there is https://codereview.stackexchange.com/)

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

Sidebar

Related Questions

I have the following code snippet, which loads data from a CSV file into
i have the following code snippet in my ANT File which compiles my project
I have following code snippet: class ABC{ public: int a; void print(){cout<<hello<<endl;} }; int
I have the following code snippet embedded into some of my divs so when
I have the following very simple code snippet which is loaded from a separate
i have the following code snippet. in which i just want to return PartyName
I have the following code snippet where some strings are initialized in the if
I have the following snippet code: my $hostname = `host \`hostname\``; which this yields
I have the following code snippet which is working fine: ifstream NDSConfig( NDS.config )
I have following code snippet in jquery.In which,I want to animate each element of

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.