flush works , but there is a time issue.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?cmF1bGF2aQ==?=

    flush works , but there is a time issue.

    (a little more info)
    after flushing the line (instead of closing streamwirter)
    it takes some x time to flush the line
    so, when I read from the file I cannot find the last written line.

    if I close the streamwriter it does find the line always.
    but , my next write fails "Cannot write to a closed TextWriter"

  • =?UTF-8?B?R8O2cmFuIEFuZGVyc3Nvbg==?=

    #2
    Re: flush works , but there is a time issue.

    raulavi wrote:
    (a little more info)
    after flushing the line (instead of closing streamwirter)
    it takes some x time to flush the line
    so, when I read from the file I cannot find the last written line.
    >
    if I close the streamwriter it does find the line always.
    but , my next write fails "Cannot write to a closed TextWriter"
    >
    Flushing the StreamWriter doesn't flush the underlying FileStream. You
    have to flush that after flushing the StreamWriter for the line to end
    up in the file.

    --
    Göran Andersson
    _____
    Göran Anderssons privata hemsida.

    Comment

    • =?Utf-8?B?cmF1bGF2aQ==?=

      #3
      Re: flush works , but there is a time issue.

      Thanks Goran...
      Sorry, could you explain a lit bit .

      so how is this process done?

      write a line
      ?????close, flush or what???

      ????what do we need here to
      read the last line written



      "Göran Andersson" wrote:
      raulavi wrote:
      (a little more info)
      after flushing the line (instead of closing streamwirter)
      it takes some x time to flush the line
      so, when I read from the file I cannot find the last written line.

      if I close the streamwriter it does find the line always.
      but , my next write fails "Cannot write to a closed TextWriter"
      >
      Flushing the StreamWriter doesn't flush the underlying FileStream. You
      have to flush that after flushing the StreamWriter for the line to end
      up in the file.
      >
      --
      Göran Andersson
      _____
      Göran Anderssons privata hemsida.

      >

      Comment

      • Peter Duniho

        #4
        Re: flush works , but there is a time issue.

        On Thu, 07 Aug 2008 08:53:01 -0700, raulavi
        <raulavi@discus sions.microsoft .comwrote:
        Thanks Goran...
        Sorry, could you explain a lit bit .
        >
        so how is this process done?
        StreamWriter writer = ...;

        writer.Flush();
        writer.BaseStre am.Flush();

        Pete

        Comment

        • =?Utf-8?B?cmF1bGF2aQ==?=

          #5
          Re: flush works , but there is a time issue.

          Thanks Peter and Goran,

          I will test it.

          "Peter Duniho" wrote:
          On Thu, 07 Aug 2008 08:53:01 -0700, raulavi
          <raulavi@discus sions.microsoft .comwrote:
          >
          Thanks Goran...
          Sorry, could you explain a lit bit .

          so how is this process done?
          >
          StreamWriter writer = ...;
          >
          writer.Flush();
          writer.BaseStre am.Flush();
          >
          Pete
          >

          Comment

          • =?Utf-8?B?cmF1bGF2aQ==?=

            #6
            Re: flush works , but there is a time issue.

            writer.BaseStre am.Flush();

            is the solution... at least for my prototype. Lets see the real thing..

            thanks againg to all.

            "Peter Duniho" wrote:
            On Thu, 07 Aug 2008 08:53:01 -0700, raulavi
            <raulavi@discus sions.microsoft .comwrote:
            >
            Thanks Goran...
            Sorry, could you explain a lit bit .

            so how is this process done?
            >
            StreamWriter writer = ...;
            >
            writer.Flush();
            writer.BaseStre am.Flush();
            >
            Pete
            >

            Comment

            Working...