MFC:displaying file contents.....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shakthi
    New Member
    • Sep 2006
    • 13

    MFC:displaying file contents.....

    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
  • sivadhas2006
    New Member
    • Nov 2006
    • 142

    #2
    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.

    Comment

    • shakthi
      New Member
      • Sep 2006
      • 13

      #3
      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.

      Comment

      Working...