1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Simple file input question?

Discussion in 'C' started by LeighRogers, May 8, 2007.

  1. LeighRogers

    LeighRogers New Member

    Joined:
    May 8, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    if (myfile.is_open())
      {
        while (! myfile.eof() )
        {
          for(int b=0;b<PlayListLength;b++)
          {
          getline (myfile,line);
          Title = line;
          getline (myfile,line);
          Artist = line;
          getline (myfile,line);
          Length = line;
          Playlist[b] = new Mp3(Title, Artist, Length);
          }
        }
    
    To read from a file and use three lines at a time to create a new mp3 within an array. I need the third value (Length) to be read as an int instead of a string.

    Can anyone help?!

    Thank you very much.

    Leigh Rogers
     

Share This Page