Click here to Skip to main content
15,907,281 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCScrollView doesn't respond to mousewheel or keyboard Pin
SeniorBob14-Mar-07 13:22
SeniorBob14-Mar-07 13:22 
Questionim just learning to prgram and have troubleing starting this question Pin
bigtimer102214-Mar-07 12:32
bigtimer102214-Mar-07 12:32 
AnswerRe: im just learning to prgram and have troubleing starting this question Pin
Bram van Kampen14-Mar-07 16:30
Bram van Kampen14-Mar-07 16:30 
AnswerRe: im just learning to prgram and have troubleing starting this question Pin
_AnsHUMAN_ 14-Mar-07 18:52
_AnsHUMAN_ 14-Mar-07 18:52 
GeneralRe: im just learning to prgram and have troubleing starting this question Pin
bigtimer102214-Mar-07 18:54
bigtimer102214-Mar-07 18:54 
GeneralRe: im just learning to prgram and have troubleing starting this question Pin
_AnsHUMAN_ 14-Mar-07 19:03
_AnsHUMAN_ 14-Mar-07 19:03 
GeneralRe: im just learning to prgram and have troubleing starting this question Pin
bigtimer102214-Mar-07 19:03
bigtimer102214-Mar-07 19:03 
QuestionSimple Problem? Blind Author cant see? Pin
LeighRogers14-Mar-07 11:50
LeighRogers14-Mar-07 11:50 
Hello all,
small problem with a simple app.

Its a simple Mp3 player app (simultation only). I have an MP3 Class that appears to load fine. It crashes out when I call the PrintMP3Details() function in Mp3.h. I get part of the output ie:
I'd really appreciate any help that anyone could provide - I've asked my lecturer four times over the past 7 days and he hasn't even replied... Sniff | :^)

Thanks in advance - Much appreciated.

"
Track 0 Contains:
Artist : BOMBS OUT HERE.....
"

MP3Player.Cpp
#include <fstream><br />
#include <iostream><br />
#include "mp3.h"<br />
<br />
using namespace std;<br />
int main (void)<br />
{<br />
    int length, count, iNo, menu, loop;<br />
    char str[80], fil[80], track[80], artist[80];<br />
    count = 0;<br />
    string filename;<br />
    cout << "Welcome to the MP3 player" << endl;<br />
    cout << "please enter filename (playlist.txt is default)" << endl;<br />
cin >> fil;                                                                     //Stores filename<br />
ifstream in(fil);                                                               //Opens file<br />
if(!in)                                                                         //if File cannot open<br />
{ <br />
cout << "Cannot open file.\n" << endl; <br />
} <br />
while(!in.eof())                                                                // While not end of file...<br />
{<br />
  in >> artist;                                                                 //Store first item as artist<br />
  in >> track;                                                                  //Store second item as track<br />
  in >> length;                                                                 //Store third item as length<br />
  count++;                                                                      <br />
} <br />
cout << endl;<br />
iNo=count;                                                                      //Copy total no. of records to iNO.<br />
<br />
cout << endl <<"File contains " << count << " files." << endl;                  //Print no. of records in file<br />
  in.close();                                                                   //Close file.<br />
Mp3 *Playlist[iNo];                                                             //Create pointer array of size iNO.<br />
//in.open();                                                                    //Open file<br />
count = 0;                                                                      //Reset Counter<br />
ifstream in2(fil);                                                              //Opens file<br />
if(!in)                                                                         //if File cannot open<br />
{ <br />
cout << "Cannot open file.\n" << endl; <br />
} <br />
cout << "marker " << endl;<br />
while(!in.eof())          <br />
{<br />
  in2 >> artist;                                                                //Store first item as artist<br />
  in2 >> track;                                                                 //Store second item as track<br />
  in2 >> length;                                                                //Store third item as length<br />
  count++;            <br />
  Playlist[count] = new Mp3(artist, track, length);    <br />
  cout << count << " contains " << artist << track << length << endl;                                                      <br />
} <br />
cout << endl;<br />
in.close();<br />
  <br />
  <br />
  <br />
  <br />
  while (menu !=0){<br />
     cout << "Please select from the following..." << endl<br />
     << "1) Print playlist (currently loaded)" << endl<br />
     << "0) Close MP3 player " <<endl << endl;<br />
     cin >> menu;<br />
     cout << endl;       <br />
  <br />
  switch (menu)<br />
{<br />
case 1:<br />
    for (int loop=0; loop<iNo;loop++)<br />
{<br />
//    Portfolio[iAC]->PrintAccountDetails();<br />
    cout << "Track " << loop << " Contains : " << endl;<br />
    Playlist[loop]->PrintMP3Details();<br />
    cout << endl << endl;<br />
}<br />
break;<br />
  <br />
case 2:<br />
     break;<br />
     return 0; <br />
}//End switch<br />
}//End While<br />
}//End of main<br />



MP3.h
<br />
    #include <fstream><br />
    #include <iostream><br />
    using namespace std;<br />
    <br />
    class Mp3<br />
    {   <br />
    private<br />
    :<br />
// Attributes...................................................................<br />
            string Artist;<br />
            string Track;<br />
            int Length;<br />
    <br />
    public:<br />
           <br />
//Constructor...................................................................<br />
    Mp3::Mp3(string Nartist, string Ntrack, int Nlength)<br />
    {<br />
    Artist = Nartist;<br />
    Track = Ntrack;<br />
    Length = Nlength;             <br />
    }<br />
    <br />
// Methods......................................................................<br />
// Gets.........................................................................<br />
    string GetArtist()const           {return Artist;}<br />
    string GetTrack()const            {return Track;}<br />
    int GetLength()const              {return Length;}<br />
    <br />
// Sets.........................................................................<br />
    void SetArtist (string strArtist) {Artist = strArtist;}<br />
    void SetTrack  (string strTrack)  {Track = strTrack;}<br />
    void SetLength (int    iLength)   {Length = iLength;}<br />
    <br />
//Functions.....................................................................<br />
      void PrintMP3Details() <br />
    {<br />
cout  << "Artist                   : " << Artist << endl<br />
      << "Track                    : " << Track  << endl<br />
      << "Length                   : " << Length << endl;<br />
    }<br />
    }; // end of Account class<br />

AnswerRe: Simple Problem? Blind Author cant see? Pin
John R. Shaw14-Mar-07 15:33
John R. Shaw14-Mar-07 15:33 
AnswerRe: Simple Problem? Blind Author cant see? Pin
Hamid_RT14-Mar-07 19:15
Hamid_RT14-Mar-07 19:15 
QuestionNeed help communicating with MFC dialog boxes (domodal) [modified] Pin
CoffeeAddict1914-Mar-07 11:10
CoffeeAddict1914-Mar-07 11:10 
AnswerRe: Need help communicating with MFC dialog boxes (domodal) Pin
toxcct14-Mar-07 11:23
toxcct14-Mar-07 11:23 
GeneralRe: Need help communicating with MFC dialog boxes (domodal) Pin
andersod214-Mar-07 12:27
andersod214-Mar-07 12:27 
GeneralRe: Need help communicating with MFC dialog boxes (domodal) [modified] Pin
CoffeeAddict1914-Mar-07 18:24
CoffeeAddict1914-Mar-07 18:24 
GeneralRe: Need help communicating with MFC dialog boxes (domodal) Pin
andersod214-Mar-07 18:42
andersod214-Mar-07 18:42 
GeneralRe: Need help communicating with MFC dialog boxes (domodal) Pin
andersod214-Mar-07 13:13
andersod214-Mar-07 13:13 
GeneralRe: Need help communicating with MFC dialog boxes (domodal) Pin
toxcct14-Mar-07 22:07
toxcct14-Mar-07 22:07 
GeneralRe: Need help communicating with MFC dialog boxes (domodal) Pin
andersod215-Mar-07 10:30
andersod215-Mar-07 10:30 
Questionpassing function pointer Pin
ScotDolan14-Mar-07 10:53
ScotDolan14-Mar-07 10:53 
AnswerRe: passing function pointer Pin
Mark Salsbery14-Mar-07 11:42
Mark Salsbery14-Mar-07 11:42 
GeneralRe: passing function pointer Pin
ThatsAlok14-Mar-07 19:34
ThatsAlok14-Mar-07 19:34 
GeneralRe: passing function pointer Pin
Mark Salsbery14-Mar-07 20:13
Mark Salsbery14-Mar-07 20:13 
GeneralRe: passing function pointer Pin
ThatsAlok14-Mar-07 20:20
ThatsAlok14-Mar-07 20:20 
QuestionGet users names list Pin
Caos00014-Mar-07 9:59
Caos00014-Mar-07 9:59 
AnswerRe: Get users names list Pin
Mark Salsbery14-Mar-07 10:32
Mark Salsbery14-Mar-07 10:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.