|
-
December 6th, 2003, 02:07 AM
#1
Help with text in a dialog
hi does anybody know much about CFile? i have a problem, i can get text in a dialog box like i want but at the very end i get a funny looking character and i am using CFile heres what the code lookes like
char szBuffer [5056];
CFileException fileException;
CString filename = "readme.txt";
CFile myFile;
if ( !myFile.Open( filename, CFile::modeReadWrite, &fileException ))
{
TRACE( "Can't open file %s, error = %u\n", filename, fileException.m_cause );
}
myFile.Read(szBuffer, sizeof(szBuffer));
m_sEdit1 = szBuffer;
myFile.Flush();
UpdateData(0);
and here is what the funny looking character looks like Ì*ù please help
-
December 6th, 2003, 02:34 AM
#2
I am not sure what m_sEdit1 is, but I would guess
you need to add a terminating zero to szBuffer
before copying it to m_sEdit1.
-
December 6th, 2003, 02:40 AM
#3
m_sEdit1 is the member varible for a edit box in a dialog could u post a example of what ur talking about terminating zero to szbuffer please or show me how to do it in my code
-
December 6th, 2003, 02:52 AM
#4
Something like this:
Code:
UINT ui=myFile.Read(szBuffer, sizeof(szBuffer)-1);
szBuffer[ui]=0;
m_sEdit1 = szBuffer;
-
December 6th, 2003, 02:54 AM
#5
thank you i put the code in and it works like a charm thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|