Announcement

Collapse
No announcement yet.

PB's internal file buffering

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PB's internal file buffering

    Question about PB 3.5...

    If I've got a file opened for binary, the LEN= statement sets PB's internal buffer size I believe. My question is this: If I do a PUT, is the data written immediately to the disk, or does PB actually do some sort of caching? I assume the LEN= just sets a block size that PB uses to read from disk, right?


    Thanks,
    Jason
    [email protected]

  • #2
    Correct, for binary files, file buffering is only does for INPUT and only if the file is not SHARED.

    While PowerBASIC does not buffer output, it's still possible that the operating system might. The FLUSH statement will ensure that the data is physically written to disk.

    --Dave


    -------------
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Home of the BASIC Gurus
    www.basicguru.com

    Comment


    • #3
      Dave, thanks for your reply! I have one more question about FLUSH now... I used FLUSH on a file that was opened with RANDOM access that had a record locked using LOCK. After the FLUSH, the record was not locked anymore. This happens in Win98 and CCI/DOS. Is this what's supposed to happen?

      Thanks for your time,
      Jason
      [email protected]

      Comment


      • #4
        I am guessing that is the correct operation.

        I tried the same thing in PDS 7.0 and got the same result. The operating system probably releases all locks when the buffers are flushed.

        --Dave


        -------------
        PowerBASIC Support
        mailto:[email protected][email protected]</A>

        Home of the BASIC Gurus
        www.basicguru.com

        Comment


        • #5
          Dave, thanks again for your quick response! I suppose I'm out of questions now

          Thanks,
          Jason

          Comment


          • #6
            Dave ..

            Surely this applies only to those files which are part of the PB
            camp? Surely this doesn't attempt to apply, for example, to
            Btrieve files that are being manipulated by a PB program. As
            well I wonder what happens to NOVELL?

            Looking back at the curious way we accidently pranged a NOVELL
            network at one hospital by repeatedly opening and closing thousands
            of very small like-sized files in continuous scan progression
            across the network. I wonder if we could have prevented the
            NOVELL attempt to keep adding more and more resources to our
            little application until it totally took over the whole resources
            of the network, by doing a forced FLUSH before closing each file?

            That said, in OS/2, would doing a forced FLUSH, as a matter of
            routine, be of any value in cleaning up after an application
            does a specific thing, in a sort of attempt to prompt OS/2 into
            perhaps pre-empting in our favor?

            I'm also thinking about the use of communications problems with
            comm port activity. Does FLUSH have any effect on I/O channels
            that can be opened for comm port use? In other words, can it
            be used to flush a buffer as well??

            Sorry if I'm asking questions that have no relevance. I don't
            claim to be an expert at anything.. just trying to learn things.

            -------------
            Mike Luther
            [email protected]
            Mike Luther
            [email protected]

            Comment


            • #7
              Mike,

              I have no idea how FLUSH effects Netware or OS/2. In a DOS box in Windows NT FLUSH causes all file locks to be lost.

              FLUSH does not work with COM ports, only files.

              And yes, FLUSH only effects file opened by the PowerBASIC OPEN statement.

              --Dave


              -------------
              PowerBASIC Support
              mailto:[email protected][email protected]</A>

              Home of the BASIC Gurus
              www.basicguru.com

              Comment

              Working...
              X