CD-ROM Read

This is a discussion on CD-ROM Read within the Networking/Device Communication forums, part of the General Programming Boards category; Anyone have any good guides on CD-ROM reading? I have a new interest in this..and I have no idea where ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    220

    Question CD-ROM Read

    Anyone have any good guides on CD-ROM reading? I have a new interest in this..and I have no idea where to turn too. What i'm looking for is to read a text file on a disc and display it on the screen in a console window..that sort of a thing. Any idea how this can be done? If so please state your source/anything else interesting you want to note about CD-ROM reading, thank you for your assistance It is very much appreciated.
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Just open the file as you would any other, specifying its full path.

    Eg, assuming your CD is drive F
    fp = fopen("f:\\myfile.txt", "r");
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    220
    Could you explain your code please?

    I'm new to fopen.

    Thank you for your reply by the way I appreciate it.
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Before I explain in detail, what language are you intending to write this in? My sample was C, but no point in telling about it if you're not writing in the same language.

    Anyway, whatever language, just open the file as you would any other, giving the full path name to it.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Registered User
    Join Date
    Mar 2004
    Posts
    220
    Thank you And it was C++.
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

  6. #6
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Code:
    #include <iostream>
    #include <fstream>
    
    using namespace std;
    
    int main(void)
    {
      ifstream fs("f:\\myfile.txt");
      string st;
      
      while (getline (fs, st, '\n'))
      {
        cout <<st <<endl;
      }
      
      fs.close();
      return(0);
    }
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  2. mp3 players vs mp3 cd players
    By Geo-Fry in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-06-2003, 08:22 PM
  3. Pointer's
    By xlordt in forum C Programming
    Replies: 13
    Last Post: 10-14-2003, 02:15 PM
  4. Read Array pro!!Plz help!!
    By Supra in forum C Programming
    Replies: 2
    Last Post: 03-04-2002, 02:49 PM
  5. Help! Can't read decimal number
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 09-07-2001, 02:09 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21