By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,377 Members | 1,660 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,377 IT Pros & Developers. It's quick & easy.

MFC:displaying file contents.....

P: 13
Hi all,
Got good response and solution for my previous posts.Thanks a lot to sudhir and sivadass.Now i have one more doubt.I WANT TO DISPLAY THE CONTENTS OF A FILE THAT IS PLACED IN AN EDITCONTROL..I tried using CArchive.Am able to open my file by using Open() function but cant display its contents.plzzz guide me with the correct format.PLEASE HELP ME WITH THE CORRECT CODE.Sorry if my question is soo silly.

Thank you all in advance!!

regards,
shakthi
Nov 9 '06 #1
Share this Question
Share on Google+
2 Replies


sivadhas2006
100+
P: 142
Hi,

You can use FILE * for ths purpose.

The steps you should follow.
1. Open the file in read mode.
2. Get the file size.
3. Allocate the buffer.
4. Read the file contents.
5. Close the file.
6. Set the contents to the edit control.

Regards,
M.Sivadhas.
Nov 9 '06 #2

P: 13
hi,
thanks for the reply.but doing so i think the contents will be displayed in the editcontrol.The size of the edit control is small i think(32 k not sure...plz correct me if am wrong)What to do if the size is larger than that?Mainly i want to open the file with its appication form.That is if i click a word file then it should open as it is.i.e in MS WORD.
In a file dialog box if we select a file then it opens as it is.I want my file to open like that.plz let me know if my question is not clear.Thanks a lot once again.

regards,
shakthi.
Nov 9 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.