Displaying text file into a dialog

S

semi

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
 
V

Victor Bazarov

semi said:
I am using VS C++ to make a gui [...]

Please go to comp.os.ms-windows.programmer.win32. Here your
issues are off-topic. Another place is microsoft.public.vc.*

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top