Thread: C program MP3 Player

  1. #16
    Registered User
    Join Date
    Dec 2007
    Posts
    10
    Anyone else?

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Take it one step at a time and post any questions you have.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #18
    Registered User
    Join Date
    Dec 2007
    Posts
    10
    Hi, everyone again, well I completed the MP3 program and it works. Waheey.

    I am know just putting the finishing touches on it and wonderd I am trying to clear the screen I am putting this code, but it does not seem to do anything.
    Code:
    void dispTitle(void)
    {
         int i=0;
         while (i <25)
         {printf ("\n");
         i++;}
    It has the error expected primary expression before void.

    Thanks

  4. #19
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    You might want to provide more context for that code snippet. It looks like an incomplete function, and it may be good to know what comes before it as the problem may lie there.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #20
    Registered User
    Join Date
    Dec 2007
    Posts
    10
    ok here goes, this is the first part program
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    #define GENRE_TYPE_SIZE 30
    #define NAME_SONG_SIZE 30
    #define FILENAME_SONG_SIZE 75
    #define ARTIST_NAME_SIZE 75
    #define ARRAY_SIZE 100
    
    
    void Show_the_mp3_song_library(void);
    void Play_an_mp3song_file(void);
    void Add_an_mp3song_file(void);
    void Modify_or_Edit_an_mp3_file(void);
    void Delete_an_mp3_file(void);
    void Load_the_music_Library(void);
    void Save_the_music_Library(void);
    void show_the_track(int index);
    void dispTitle(void);
    FILE *fp;
    
    typedef struct mp3rec
    {
            char artistname[ARTIST_NAME_SIZE];
            char songname[NAME_SONG_SIZE];
            char genretype[GENRE_TYPE_SIZE];
            char mp3_filename[FILENAME_SONG_SIZE];
            int minutes;
            int seconds;
           
    };
    
    mp3rec the_song_list[ARRAY_SIZE];
    int songcount = 0; 
    
    char name_line[NAME_SONG_SIZE+2];//change the buf
    char artist_line[ARTIST_NAME_SIZE+2];
    char genre_line[GENRE_TYPE_SIZE+2];
    char mp3_filename_line[FILENAME_SONG_SIZE+2];
    int minutes;
    int seconds;
    
    
    int main (void)
    {
        int menuchoice = 0;
           
        while(menuchoice != 8)
        {
          printf("*******************************\n");
          printf("********************************************\n");
          printf("***********************\n");
          printf("********************************************\n");
          printf("*****************Version 1******************\n");
          printf("\n1:~ Save the MP3 Library");
          printf("\n2:~ Show the MP3 Library");
          printf("\n3:~ Play an MP3 Song");
          printf("\n4:~ Delete an MP3 Song");
          printf("\n5:~ Add MP3 or Song/file to the MP3 Library");
          printf("\n6:~ Modify or Edit an MP3 File");
          printf("\n7:~ Re-Load the MP3 Library");
          printf("\n8:~ Quit The Program");
          
          printf("\n\n~Enter What you Wish to do: ");
          scanf("&#37;d", &menuchoice);
    
          switch (menuchoice)
          {
                 case 1:Save_the_music_Library();
                        break;                         
                        
                 case 2:Show_the_mp3_song_library();
                        break;
                                          
                 case 3:Play_an_mp3song_file();
                        break;
                        
                 case 4:Delete_an_mp3_file();
                        break;                     
                        
                 case 5:Add_an_mp3song_file();
                        break;
                        
                 case 6:Modify_or_Edit_an_mp3_file();
                        break;
                                          
                 case 7:Load_the_music_Library();
                        break;
                        
                 case 8:
                        break;
                        
                 default:
                         printf("\n~The Choice Was Invalid : 1-8 Only Please\n\n");
          }
                         
    };
    
    void dispTitle(void)
    {
         int i=0;
         while (i <25)
         {printf ("\n");
         i++;}
    }     
    
    }

  6. #21
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Basically, you need to improve on your indentation:
    Code:
    int main (void)
    {
        int menuchoice = 0;
    
        while(menuchoice != 8)
        {
            printf("*******************************\n");
            printf("********************************************\n");
            printf("***********************\n");
            printf("********************************************\n");
            printf("*****************Version 1******************\n");
            printf("\n1:~ Save the MP3 Library");
            printf("\n2:~ Show the MP3 Library");
            printf("\n3:~ Play an MP3 Song");
            printf("\n4:~ Delete an MP3 Song");
            printf("\n5:~ Add MP3 or Song/file to the MP3 Library");
            printf("\n6:~ Modify or Edit an MP3 File");
            printf("\n7:~ Re-Load the MP3 Library");
            printf("\n8:~ Quit The Program");
    
            printf("\n\n~Enter What you Wish to do: ");
            scanf("&#37;d", &menuchoice);
    
            switch (menuchoice)
            {
            case 1:Save_the_music_Library();
                break;
    
            case 2:Show_the_mp3_song_library();
                break;
    
            case 3:Play_an_mp3song_file();
                break;
    
            case 4:Delete_an_mp3_file();
                break;
    
            case 5:Add_an_mp3song_file();
                break;
    
            case 6:Modify_or_Edit_an_mp3_file();
                break;
    
            case 7:Load_the_music_Library();
                break;
    
            case 8:
                break;
    
            default:
                printf("\n~The Choice Was Invalid : 1-8 Only Please\n\n");
            }
    
        };
    
        void dispTitle(void)
        {
            int i=0;
            while (i <25)
            {
                printf ("\n");
                i++;
            }
        }
    }
    So the problem is that The closing brace that comes after the closing brace of dispTitle() should be moved to above it. (And you do not need that semi-colon after the closing brace for the while loop in main().)

    Other than that it looks like you have quite a few global variables that could be better off declared in main().
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #22
    Registered User
    Join Date
    Dec 2007
    Posts
    10
    Quote Originally Posted by laserlight View Post
    Basically, you need to improve on your indentation:
    Code:
    int main (void)
    {
        int menuchoice = 0;
    
        while(menuchoice != 8)
        {
            printf("*******************************\n");
            printf("********************************************\n");
            printf("***********************\n");
            printf("********************************************\n");
            printf("*****************Version 1******************\n");
            printf("\n1:~ Save the MP3 Library");
            printf("\n2:~ Show the MP3 Library");
            printf("\n3:~ Play an MP3 Song");
            printf("\n4:~ Delete an MP3 Song");
            printf("\n5:~ Add MP3 or Song/file to the MP3 Library");
            printf("\n6:~ Modify or Edit an MP3 File");
            printf("\n7:~ Re-Load the MP3 Library");
            printf("\n8:~ Quit The Program");
    
            printf("\n\n~Enter What you Wish to do: ");
            scanf("%d", &menuchoice);
    
            switch (menuchoice)
            {
            case 1:Save_the_music_Library();
                break;
    
            case 2:Show_the_mp3_song_library();
                break;
    
            case 3:Play_an_mp3song_file();
                break;
    
            case 4:Delete_an_mp3_file();
                break;
    
            case 5:Add_an_mp3song_file();
                break;
    
            case 6:Modify_or_Edit_an_mp3_file();
                break;
    
            case 7:Load_the_music_Library();
                break;
    
            case 8:
                break;
    
            default:
                printf("\n~The Choice Was Invalid : 1-8 Only Please\n\n");
            }
    
        };
    
        void dispTitle(void)
        {
            int i=0;
            while (i <25)
            {
                printf ("\n");
                i++;
            }
        }
    }
    So the problem is that The closing brace that comes after the closing brace of dispTitle() should be moved to above it. (And you do not need that semi-colon after the closing brace for the while loop in main().)

    Other than that it looks like you have quite a few global variables that could be better off declared in main().
    Thanks very much

  8. #23
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Quote Originally Posted by kjs6thf View Post
    Code:
    typedef struct mp3rec
    {
            char artistname[ARTIST_NAME_SIZE];
            char songname[NAME_SONG_SIZE];
            char genretype[GENRE_TYPE_SIZE];
            char mp3_filename[FILENAME_SONG_SIZE];
            int minutes;
            int seconds;
    };
    this is not the correct syntax for a typedef.
    Code:
    typedef struct mp3rec
    {
            char artistname[ARTIST_NAME_SIZE];
            char songname[NAME_SONG_SIZE];
            char genretype[GENRE_TYPE_SIZE];
            char mp3_filename[FILENAME_SONG_SIZE];
            int minutes;
            int seconds;
    } mp3rec;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 03:30 PM
  2. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Screw with this mp3 player
    By LuckY in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 06-20-2004, 01:17 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM