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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice