DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   Working with mp3 files and folders. (http://www.daniweb.com/forums/thread157713.html)

gisek Nov 16th, 2008 3:12 pm
Working with mp3 files and folders.
 
Hi,

Recently I came up with an idea of making my own program for tagging mp3 files. I realised I'm lacking in knowledge. For now I need the following information:

1. After typing a path to a main folder, I'd like to read the names of the folders inside.

2. Than I want to visit each of those folders - get inside (Those folders will include mp3 files).

3. Finally I want to enter this section of a mp3 file where the information about e.g. atrist or genre is kept and I want to chane it.

Can anyone help tell me with this?
Thanx!

james_zheng Nov 16th, 2008 3:53 pm
Re: Working with mp3 files and folders.
 
the first 2 questions can be solved by the following sample code:
find(char * lpPath)
{
    char szFind[MAX_PATH];
    WIN32_FIND_DATA FindFileData;

    strcpy(szFind,lpPath);
    strcat(szFind,"\\*.*");

    HANDLE hFind=::FindFirstFile(szFind,&FindFileData);
    if(INVALID_HANDLE_VALUE == hFind)    return;
   
    while(TRUE)
    {
        if(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
        {
            if(FindFileData.cFileName[0]!='.')
            {
                strcpy(szFile,lpPath);
                strcat(szFile,"\\");
                strcat(szFile,FindFileData.cFileName);
                find(szFile);
            }
        }
        else
        {
            cout << FindFileData.cFileName;
        }
        if(!FindNextFile(hFind,&FindFileData))    break;
    }
    FindClose(hFind);
}
the information on artist in a mp3 file is stored in the last 128 bytes of the file. so you can simply read the last 128 bytes.


All times are GMT -4. The time now is 11:53 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC