Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. What format is this file in and how to open it in C++

What format is this file in and how to open it in C++

Scheduled Pinned Locked Moved C / C++ / MFC
c++comsysadmintutorialquestion
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 12162796
    wrote on last edited by
    #1

    Hi, I want to make a playlist editor for my MP3 player. I've upped the playlist file to my server. You can download it here: www.tommy2d.com/MyFavorite.plp I can open it with notepad without any problems. However, when i save it to UNICODE LE, UNICODEBE or whatever format Notepad support, i can't load aymore on my MP3 player... Could anybody please indicate what type of file this is and how to open it in C++? Thnx...

    M 1 Reply Last reply
    0
    • U User 12162796

      Hi, I want to make a playlist editor for my MP3 player. I've upped the playlist file to my server. You can download it here: www.tommy2d.com/MyFavorite.plp I can open it with notepad without any problems. However, when i save it to UNICODE LE, UNICODEBE or whatever format Notepad support, i can't load aymore on my MP3 player... Could anybody please indicate what type of file this is and how to open it in C++? Thnx...

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      I know that format from Samsung players. The player expects the file to be little-endian UTF-16 with no byte order mark. When you save the file with Notepad, it adds the BOM, so you'll need to remove it before putting the file on the player. --Mike-- LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ Strange things are afoot at the U+004B U+20DD

      T 1 Reply Last reply
      0
      • M Michael Dunn

        I know that format from Samsung players. The player expects the file to be little-endian UTF-16 with no byte order mark. When you save the file with Notepad, it adds the BOM, so you'll need to remove it before putting the file on the player. --Mike-- LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ Strange things are afoot at the U+004B U+20DD

        T Offline
        T Offline
        Tommy2d
        wrote on last edited by
        #3

        Ok, thanks for this information:)...But how do i go writing a program that is capable of reading and writing such files? At the moment, I'm using the CTextFileRead class found on this site. But this class is not capable of reading UTF16 files I believe...

        M 1 Reply Last reply
        0
        • T Tommy2d

          Ok, thanks for this information:)...But how do i go writing a program that is capable of reading and writing such files? At the moment, I'm using the CTextFileRead class found on this site. But this class is not capable of reading UTF16 files I believe...

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          The easiest way is probably wfstream, which reads/write wchar_t and can do line-by-line input. --Mike-- LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ Strange things are afoot at the U+004B U+20DD

          T 1 Reply Last reply
          0
          • M Michael Dunn

            The easiest way is probably wfstream, which reads/write wchar_t and can do line-by-line input. --Mike-- LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ Strange things are afoot at the U+004B U+20DD

            T Offline
            T Offline
            Tommy2k
            wrote on last edited by
            #5

            Hi, I just the following code but it just reads the first char and then it quits on my poor textfile. This is the same thing as what happened when i used the class. The size it determines is correct however. Please help me on this. I don't have any exp with anything else then just plain char arrays I really don't know what to do next. // reading binary file #include #include #include #include using namespace std; const char * filename = "J:\\MyJukeBox\\PLAYLIST\\MyFavorite.plp"; int main () { wchar_t * buffer; long size; wfstream file (filename, ios::in|ios::ate); size = file.tellg(); file.seekg (0, ios::beg); buffer = new wchar_t [size]; file.read (buffer, size); file.close(); cout << "the complete file is in a buffer. Size:" << size; MessageBox(0,buffer,NULL,0); delete[] buffer; return 0; }

            N 1 Reply Last reply
            0
            • T Tommy2k

              Hi, I just the following code but it just reads the first char and then it quits on my poor textfile. This is the same thing as what happened when i used the class. The size it determines is correct however. Please help me on this. I don't have any exp with anything else then just plain char arrays I really don't know what to do next. // reading binary file #include #include #include #include using namespace std; const char * filename = "J:\\MyJukeBox\\PLAYLIST\\MyFavorite.plp"; int main () { wchar_t * buffer; long size; wfstream file (filename, ios::in|ios::ate); size = file.tellg(); file.seekg (0, ios::beg); buffer = new wchar_t [size]; file.read (buffer, size); file.close(); cout << "the complete file is in a buffer. Size:" << size; MessageBox(0,buffer,NULL,0); delete[] buffer; return 0; }

              N Offline
              N Offline
              normanS
              wrote on last edited by
              #6

              Is the problem with reading the file or displaying it in your messagebox? The first thing I would suggest is to use debugger to check if file.read (buffer, size); actually reads the file into buffer (break after this line and look at buffer.) If buffer does not contain the correct contents, the problem is with reading. Maybe the read is expecting 8-bit ASCI? If buffer actually has the ciorrect contents, the problem may be that MessageBox(0,buffer,NULL,0); expects buffer to be ASCI text, so if it is contains a 0x00 byte, this is seen as end of string.

              T 1 Reply Last reply
              0
              • N normanS

                Is the problem with reading the file or displaying it in your messagebox? The first thing I would suggest is to use debugger to check if file.read (buffer, size); actually reads the file into buffer (break after this line and look at buffer.) If buffer does not contain the correct contents, the problem is with reading. Maybe the read is expecting 8-bit ASCI? If buffer actually has the ciorrect contents, the problem may be that MessageBox(0,buffer,NULL,0); expects buffer to be ASCI text, so if it is contains a 0x00 byte, this is seen as end of string.

                T Offline
                T Offline
                Tommy2d
                wrote on last edited by
                #7

                The problem is with the reading, but i already knew that. I just really don't know how to read this file...The format was UTF16 without the last byte...

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups