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 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 64k
  • Answers 64k
  • 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
  • added an answer I had a similar issue to this once, it turned… May 11, 2026 at 10:41 am
  • added an answer You could write a ton of code to do this.… May 11, 2026 at 10:41 am
  • added an answer I'm guessing you really just want globbing rather than full… May 11, 2026 at 10:41 am

Related Questions

I was using mysql++ library and compiling with GCC 3.3.4. That GCC version had
I'm running my first project that I'm compiling with flex builder. Before I used
Hello I am compiling a program with make but I get the error of
I've been hitting a java.lang.OutOfMemoryError: PermGen error when compiling a project with ant under
When compiling the following simpleType with the XJC compile (from the JAXB package)... <xs:simpleType
Compiling a file that uses OpenGL with Visual C++, when I try to include
I'm compiling a simple .c in visual c++ with Compile as C Code (/TC)
I'm pre-compiling a C program containing Pro*C code with Oracle 10.2 and AIX 5.2
Here's another problem with qt: I extend a QAbstractTableModel, but I get a compiling
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE

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.