|
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...
|
|
|
|
|
|
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.
<br />
#include <iostream><br />
#include <fstream><br />
#include <stdlib.h><br />
#include <windows.h><br />
using namespace std;<br />
<br />
const char * filename = "J:\\MyJukeBox\\PLAYLIST\\MyFavorite.plp";<br />
<br />
int main () {<br />
wchar_t * buffer;<br />
long size;<br />
wfstream file (filename, ios::in|ios::ate);<br />
size = file.tellg();<br />
file.seekg (0, ios::beg);<br />
buffer = new wchar_t [size];<br />
file.read (buffer, size);<br />
file.close();<br />
<br />
cout << "the complete file is in a buffer. Size:" << size;<br />
MessageBox(0,buffer,NULL,0);<br />
<br />
delete[] buffer;<br />
<br />
return 0;<br />
}<br />
|
|
|
|
|
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.
|
|
|
|
|
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...
|
|
|
|
|
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.tommy2k.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...
|
|
|
|
|
Dear all,
I have a program which, when active, sits in the taskbar. So long as the progam is open I want to add a button next to the min/max/close buttons on all open windows (operating system windows xp). Does anyone know where I can find example code where this is being done... I have searched through the code project website but haven't been able to locate anything of this nature and would be really grateful if someone could give me some help.
Thanks
Andrew
|
|
|
|
|
Hi, I need to delete a file.
When i do :
if( remove( tpath ) == -1 ) perror( "Could not delete file" );
else printf( "Deleted\n" );
I get : access denied, I know this is because the file is still open but for personal reasons I can't close it, I just need to delete it
So this file really needs to be destroyed, is there a way to force the deletion ??
|
|
|
|
|
Are you not in a position where the file could be closed first, then deleted?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
|
hi - i have an mfc activex control and want to save its visuals to a file. how should i do this? the graphics on the control are created through GDI+, so should i go through Graphics contents to an Image, or may be through CDC? thanx
so far i have this:
CDC* pdc = GetDC();
RECT rect;
GetClientRect(&rect);
Graphics graphics(pdc->GetSafeHdc());
Bitmap bitmap(rect.right -
rect.left, rect.bottom -
rect.top, &graphics);
CLSID pngClsid;
GetEncoderClsid(L"image/jpeg", &pngClsid);
bitmap.Save(fineName, &pngClsid, NULL);
but it just outputs a black screen, which is understandable
|
|
|
|
|
You should be able to use the WM_PRINT message to render the control into a DC of your own choice.
With a bitmap of your own sleected into it of the correct size, you could then save the output to a file.
If you vote me down, my score will only get lower
|
|
|
|
|
thanx, Roger, i didn't notice anybody replied to the post. i found a solution, check my previous post.
i guess your idea is close to what i finally implemented - thanx !
|
|
|
|
|
my search led me to GdipCreateBitmapFromGraphics method and this post:
http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=37541&lngWId=1
where this guy - "Avery" - gives a great hint
|
|
|
|
|
Is it possible to clear the internet history and if so how?
|
|
|
|
|
Are you talking about this list:
HKCU\Software\Microsoft\Internet Explorer\TypedURLs
There's also the index.dat file stored in the Cookies folder.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
Hmm,
I can't compile it. Do you have any more idees?
I realy need to clear the internet history.
|
|
|
|
|
Larsson wrote:
I can't compile it.
Why? If you are trying to compile the whole project, don't bother. Just extract the ClearHistory() function, and any other functions that it might use, and incorporate them into your own project.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Ok,
But I can't find it. can you send me al that I need so I can test it?
|
|
|
|
|
Larsson wrote:
But I can't find it.
Where did you look?
Larsson wrote:
can you send me al that I need so I can test it?
It is a member of the CGlobal class (in the global.cpp file).
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Yes I have look in the global.cpp file but I dont see it,Should you be kind to create a MFC Test app and send it to me?
|
|
|
|
|
Larsson wrote:
Yes I have look in the global.cpp file but I dont see it
That's because you are looking in the wrong global.cpp file. There are two. Look in the other one.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Well I'm sorry I dont see it.
Can you be so kind to send me a MFC test program?
|
|
|
|