Click here to Skip to main content
15,904,416 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: wparm,lparm Pin
Sarath C24-May-06 21:19
Sarath C24-May-06 21:19 
Questionnew com port driver Pin
MyOwnShadow24-May-06 20:06
MyOwnShadow24-May-06 20:06 
AnswerRe: new com port driver Pin
NiceNaidu24-May-06 20:49
NiceNaidu24-May-06 20:49 
Questionsingleton inheritance Pin
Krishnatv24-May-06 19:55
Krishnatv24-May-06 19:55 
AnswerRe: singleton inheritance Pin
Nibu babu thomas24-May-06 20:16
Nibu babu thomas24-May-06 20:16 
QuestionCRichEditCtrl Pin
VinayCool24-May-06 19:47
VinayCool24-May-06 19:47 
AnswerRe: CRichEditCtrl Pin
Nibu babu thomas24-May-06 20:25
Nibu babu thomas24-May-06 20:25 
AnswerRe: CRichEditCtrl Pin
Steve Echols24-May-06 20:30
Steve Echols24-May-06 20:30 
I get the vague feeling I'm doing someone's homework....

You can either lookup CRichEditCtrl's StreamIn function or if you need a quick and dirty file reader (for small files), do something like:

FILE *fp = fopen(str,"r");<br />
if (fp)<br />
{<br />
	// goto the end of file<br />
	fseek(fp, 0L, SEEK_END);<br />
	// get the length of the file<br />
	long fileLen = ftell(fp);<br />
	// go back to the start of the file<br />
	rewind(fp);<br />
<br />
	// allocate buffer for file contents<br />
	char* text = new char[fileLen + 1];<br />
<br />
	// read the file into the buffer<br />
	fread(text, 1, fileLen, fp);<br />
<br />
	// set the window text<br />
	m_FCONT.SetWindowText(text);<br />
<br />
	delete [] text;<br />
<br />
	fclose(fp);<br />
}<br />
else<br />
{<br />
	MessageBox("error opening file.",MB_OK | MB_ICONINFORMATION);<br />
	return;<br />
}<br />


This code is totally untested, but should give you the general idea. Good luck!



- S
50 cups of coffee and you know it's on!
GeneralRe: CRichEditCtrl Pin
VinayCool24-May-06 20:44
VinayCool24-May-06 20:44 
GeneralRe: CRichEditCtrl [modified] Pin
Steve Echols24-May-06 21:05
Steve Echols24-May-06 21:05 
GeneralRe: CRichEditCtrl [modified] Pin
VinayCool24-May-06 21:37
VinayCool24-May-06 21:37 
AnswerRe: CRichEditCtrl Pin
_anil_24-May-06 20:36
_anil_24-May-06 20:36 
GeneralRe: CRichEditCtrl Pin
VinayCool24-May-06 20:46
VinayCool24-May-06 20:46 
AnswerRe: CRichEditCtrl Pin
NiceNaidu24-May-06 20:40
NiceNaidu24-May-06 20:40 
GeneralRe: CRichEditCtrl Pin
VinayCool24-May-06 20:48
VinayCool24-May-06 20:48 
AnswerRe: CRichEditCtrl Pin
Hamid_RT24-May-06 20:53
Hamid_RT24-May-06 20:53 
QuestionOverwrite message box while using SHFileOperation to copy a file Pin
zahid_ash24-May-06 19:41
zahid_ash24-May-06 19:41 
AnswerRe: Overwrite message box while using SHFileOperation to copy a file Pin
Hamid_RT24-May-06 20:04
Hamid_RT24-May-06 20:04 
GeneralRe: Overwrite message box while using SHFileOperation to copy a file Pin
zahid_ash24-May-06 20:09
zahid_ash24-May-06 20:09 
GeneralRe: Overwrite message box while using SHFileOperation to copy a file Pin
Nibu babu thomas24-May-06 20:14
Nibu babu thomas24-May-06 20:14 
QuestionBase64String Pin
satsumatable24-May-06 19:24
satsumatable24-May-06 19:24 
Questionhow to get the return value when we select a checkbox Pin
keerthikaaa24-May-06 19:21
keerthikaaa24-May-06 19:21 
AnswerRe: how to get the return value when we select a checkbox Pin
_anil_24-May-06 19:40
_anil_24-May-06 19:40 
AnswerRe: how to get the return value when we select a checkbox Pin
NiceNaidu24-May-06 19:57
NiceNaidu24-May-06 19:57 
QuestionSafeArray Pin
satsumatable24-May-06 17:51
satsumatable24-May-06 17:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.