CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 1999
    Posts
    26

    Can I see the file text content during the file's opened?

    I am writting a program to write a string to an exist file everyseveral seconds. I use CStdioFile to create and open a file, I can see the file text content only after the file's closed. My question is if I can see the content of the file during the file's opened. Must I close the file if I want to see the text content?

    kshen


  2. #2
    Join Date
    Jul 1999
    Location
    Pasadena, CA - USA
    Posts
    351

    Re: Can I see the file text content during the file's opened?

    Hi,

    When you create the file with CFile, make sure you use the CFile::modeReadWrite in the nOpenFlags parameter. That should allow you to read and write to the file.



    Regards,

    Paul Belikian

  3. #3
    Join Date
    Nov 2000
    Posts
    70

    Re: Can I see the file text content during the file's opened?

    Were you able to do this? I am having the same problem here.


  4. #4
    Join Date
    Apr 2000
    Location
    San Francisco, California, USA
    Posts
    4,467

    Re: Can I see the file text content during the file's opened?

    Use CFile::shareDenyWrite mode flag then opening file for writing.
    This will allow other programs such as Notepad to read file while
    it is open.

    Russian Software Development Network -- http://www.rsdn.ru

  5. #5
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266

    Re: Can I see the file text content during the file's opened?

    You did not specify whether you want to read the text by the same program that is writing it or whether you want to read the text by another program. The answer varies depending upon which you need. I think you have answers for both possibilities, though.


    ****************************************************************************************************
    Ratings are unimportant but feedback is. Let the helper and the worldwide community know what works, perhaps with ratings.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured