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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:24:41+00:00 2026-05-11T07:24:41+00:00

compiling with gcc C99 I am trying to compare 2 string using string compare.

  • 0

compiling with gcc C99

I am trying to compare 2 string using string compare. However, I seem to be getting a stack dump on the strcmp line.

**attribute will contain these, so I am looking for frametype.

[name] [time] [type] [time] [name] [callref] [type] [string] [name] [port] [type] [int16] [name] [frametype] [type] [int16] 

Is this correct way to compare.

Many thanks for any suggestions,

void g_start_element(void *data, const char *element, const char **attribute) {     for(i = 0; attribute[i]; i++)     {     /* Only interested in the frametype */         if(strcmp(attribute[i], 'frametype') == 0)         {             /* do some work here */         }       } } 
  • 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. 2026-05-11T07:24:41+00:00Added an answer on May 11, 2026 at 7:24 am

    The context of this code is expat parsing – see this post. The attributes array is alternating name and value, with a single 0 to terminate.

    Unless you’re looking for any attribute whose name or value is equal to your test string (which would be somewhat unusual), then your code should increment i by 2 rather than 1 – so that it steps over both a name and a value.

    You should be comparing either attribute[i] to match a name, or or attribute[i+1] to match a value.

    Don’t assume that the attributes will be in any particular order. Currently you’re only looking at attribute1, which is the value of the first attribute returned. If there are more than one attribute, they can be returned in any order.

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

Sidebar

Ask A Question

Stats

  • Questions 93k
  • Answers 93k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Here is an example I have thrown together for you.… May 11, 2026 at 6:37 pm
  • Editorial Team
    Editorial Team added an answer 10 is SIGBUS, a bus error -- you probably shouldn't… May 11, 2026 at 6:37 pm
  • Editorial Team
    Editorial Team added an answer If you want to stay correct and do this in… May 11, 2026 at 6:37 pm

Related Questions

compiling with gcc C99 I have been using enums for a while now. However,
I was using mysql++ library and compiling with GCC 3.3.4. That GCC version had
I'm having a problem with my compiler telling me there is an 'undefined reference
In MSVC, DebugBreak() or __debugbreak cause a debugger to break. On x86 it is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.