What format is this file in and how to open it in C++
-
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...
-
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...
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
-
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
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...
-
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...
The easiest way is probably
wfstream
, which reads/writewchar_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 -
The easiest way is probably
wfstream
, which reads/writewchar_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+20DDHi, 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; }
-
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; }
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.
-
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.