#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    2
    Rep Power
    0

    Reading in an mp3 file


    Hi, I'm trying to read in an mp3 file and for some reason it is not working. I am using Dev++. The mp3 file name is sample.mp3. I put that into the parameters and it keeps giving me an error. Here is that part of the code..
    Code:
    FILE *f = fopen("sample.mp3", "rb");
        if(f == NULL)
        {
             printf("\nThere was an error opening the file.\n");
             system("PAUSE");
        }
    printf(f);  //not sure if this works but i want to print the mp3 in binary
    Also is there a way to read different bytes from the binary file? For example, if I wanted to see what the 3rd from last byte of the file is... Is that possble? Thanks a lot.
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,851
    Rep Power
    481
    You need to study more c programming before you try to write difficult programs like this. Sure, I could tell you to investigate fread or fseek, but you're not yet ready for these.

    Instead of writing code, use a utility like hexdump . There are a great many programs already available.
    Last edited by b49P23TIvg; September 20th, 2012 at 09:10 PM.
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    2
    Rep Power
    0
    i know a bit about fread and fseek but i guess you are right for the most part

IMN logo majestic logo threadwatch logo seochat tools logo