Hello,
I am using VS C++ to make a gui that displays a text file contents from
main dialog. So I created main dialog and another dialog for text file
viewer. From the main dialog, I call text file viewer
dialog(ViewDialog) when button is pressed.
I added edit control(called IDC_EDIT1) and its control
variable(my_edit). How do I display the text file contents in this?
In ViewDialog::ViewDialog, I get the contents of the text file
FILE *f=fopen(LOG_FILE,"rb");
fseek(f,0,SEEK_END);
int ltext=ftell(f);
fseek(f,0,SEEK_SET);
text = (char *)malloc(ltext+1);
fread(text,ltext,1,f);
fclose(f);
text[ltext]='\0';
And to display, I tried all four but it doesn't seem to work.
SetWindowText(text);
::SetWindowText(GetSafeHwnd(),text);
GetDlgItem(IDC_EDIT1)->SetWindowText(text);
m_edit.SetWindowText(text);
Thanks,
Seung