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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:11:15+00:00 2026-05-27T10:11:15+00:00

I am trying to make a small C utility that reads in a MP3

  • 0

I am trying to make a small C utility that reads in a MP3 tag from a file and displays it. I’m trying to make it as efficient as possible, so I’m making all of the char arrays that store the name, title, etc of the song dynamic, so they’re sized at run time. I find the size of each ‘frame’ (a frame is: name, title, etc) through the MP3 ID3 header.

I am starting with the title of the song first. The MP3 file buffer that I loaded with the fopen operation and put into a char buffer looks like this for the title:

T|0|I|0|T|0|I|0|l|0|E, 

all in hex of course. As you can see, there are 0’s in between the letters of the title, thus in C, meaning a string terminator when trying to store in a char array.

I am trying the follwing:

memcpy( bBuffFirstFrame, &bBuffTag[0x0A+10], iFrameSize );

Where bBuffTag is where all of the ID3 title information is located.

Reading the documentation, it says that memcpy should store everything from the original buffer, including null terminators. However, the char array I am creating (bBuffFirstFrame) only stores the first byte and gets terminated because of the null terminator. So instead of storing the song name “N|0|A|0|M|0|E” (0 is a null), it stores only N.

bBuffFirstFrame is being defined as:

bBuffFirstFrame = ( unsigned char* ) malloc( iFrameSize );

So my first question is, is this the best way even to approach this problem? Should I use malloc to create dynamic arrays or should I just create an array thats really big for each frame? For example:

bBuffFirstFrame[10000]? 

As you probably know, the song title changes with each MP3. Another reason I don’t want to create a pre-defined size array is that it might cause a buffer overflow for a real big song name.

Final question, is there a way to store null terminators inside of a char array without terminating the string?

Sorry if this sounds confusing. Thanks!

  • 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-27T10:11:16+00:00Added an answer on May 27, 2026 at 10:11 am

    The null terminators will only be respected by the string functions, so if you know the size of the strings you’re reading etc. you should be fine — are you sure you’re using memcpy and not strcpy? I know it sounds silly to ask given what you’ve posted, but memcpy shouldn’t stop at a null terminator.

    I would suggest that iFrameSize is actually not holding the value you expect and that is where the problem is coming from


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

Sidebar

Related Questions

I'm trying to make a small Mosaic programm, that draws squares randomly all over
I'm trying to make a small tool that makes use of the Debugger Engine
I'm trying to make a small program that could intercept the open process of
I'm currently trying to make a small application that performs different duties. Right now
I'm trying to build a small class-like container that will make it a little
'm trying to make a small modification to django lfs project, that will allow
Im trying to make a small app in c++ that saves midifiles with this
I'm trying to make a small VBScript that compacts a MS Access 2007 database
i'm trying to make a small project that uses multiple forms (dialogs) for different
I am trying to make some small additions to some old java code that

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.