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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:15:45+00:00 2026-06-11T11:15:45+00:00

best to explain with an example: in my AudioItem.h #define ITEM_CAPACITY 100 typedef struct

  • 0

best to explain with an example:

in my AudioItem.h

#define ITEM_CAPACITY 100

typedef struct DataStruct {
    void *                          content;
    UInt32                          size;
} DataStruct;

typedef DataStruct *DataStructRef;

@interface AudioItem : NSObject
{        
    DataStructRef data;        
}

@property (assign, readwrite) DataStructRef data;

in AudioItem.m
@synthesize data;

-(id)initWithID:(NSString *)itemID
{
    self = [super init];        
    data->content = malloc(ITEM_CAPACITY);
    return self;
}

The above code looks a lot like this one, but I get a BAD_EXEC_ERROR.. how come? The reason why I would like to use a C buffer rather than some NSMutableData or whatever is b/c I’ve tried using NSMutableData and I feel like it’s slowing down my real time application

  • 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-11T11:15:46+00:00Added an answer on June 11, 2026 at 11:15 am

    it fails because data is a null pointer when you set its content.

    the easy way to do this is:

    enum { ITEM_CAPACITY = 100 };
    
    typedef struct DataStruct {
        char content[ITEM_CAPACITY];
        UInt32 size;
    } DataStruct;
    
    @interface AudioItem : NSObject
    {        
    @private
        DataStruct data;
    }
    
    @implementation AudioItem
    - (id)initWithID:(NSString *)itemID
    {
        self = [super init];
        if (0 == self) return;
        data.size = ITEM_CAPACITY;
        return self;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me explain best with an example. Say you have node class that can
the best way to explain is with example so: this is the model public
The best way to explain my problem is by a example. I have a
I need to explain this by example: Is there a best practice or preference
I can best explain my question with an example. I recently downloaded Python for
Best to explain with an example: int RecordCount { return dataAdapter.getCount(); // database access
It's probably best to explain with an example. This is an example linked from
I think the best way to explain this is with an example: class A
I can best explain this by showing a example of what I wish I
Probably best to explain with an example: <div id=tab-1> <input name=1 type=text /> <input

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.