mp3 player load list save list help needed
Jan 17, 2013 at 5:52am UTC
The mp3player plays and the listbox getcursel works
I have a savelist button and a load list.
I Save a list and i load it into the listbox. When i try to play the file..nothing happens. must have garbage around it because my static text loads all the song paths....
code for load list
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
pFileDialog = new CFileDialog(TRUE);
pFileDialog->m_ofn.lpstrDefExt="wlf" ;
pFileDialog->m_ofn.lpstrFilter = "Wolf File (*.wlf)\0\0" ;
pFileDialog->m_ofn.lpstrFile = fileName.GetBuffer(56);
pFileDialog->m_ofn.nMaxFile = 256;
pFileDialog->DoModal();
FILE* pInFile = fopen (fileName, "rt" );
char strLine [256000]; // if your file has longer
if (pInFile) {
while (fgets (strLine, sizeof (strLine), pInFile)) {
m_LB.AddString(strLine);
}
fclose (pInFile);
}
code save list
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
pFileDialog = new CFileDialog(FALSE);
pFileDialog->m_ofn.lpstrDefExt="wlf" ;
pFileDialog->m_ofn.lpstrFilter = "Wolf File (*.wlf)\0\0" ;
pFileDialog->DoModal();
strFileName = pFileDialog->GetPathName();
myFile.Open(strFileName, CFile::modeCreate + CFile::modeWrite);
for ( int ii=0; ii< m_LB.GetCount(); ii++ )
{
m_LB.GetText(ii,strData);
myFile.Write(strData,strData.GetLength());
myFile.Write("\r\n" ,2);
}
myFile.Close();
Topic archived. No new replies allowed.