Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: System.IO.FileStream

$
0
0

      method-id btnGo_Click final private.

      01  ls-CharsRead pic 9(09).

      01  ls-CharsReadx redefines ls-CharsRead.

          03  filler   pic 9(06).

          03  ls-Chars1000 pic 9(03).

      procedure division using by value sender as object e as type System.EventArgs.

          set btnGo::Enabled to false

          set ws-cFileStream to type System.IO.FileStream::New(txtFileName::Text::Trim(" "), type System.IO.FileMode::Open, type System.IO.FileAccess::Read)

          invoke ws-cFileStream::Seek(0, type System.IO.SeekOrigin::Begin)

          declare numBytesToRead as type System.Int32

          set numBytesToRead to ws-cFileStream::Length

          set txtTotalChars::Text to numBytesToRead

          declare numBytesRead as type System.Int32

          set numBytesRead to zero

          declare n as type System.Int32

          declare b as type Byte

          perform until numBytesToRead = 0

              set b to ws-cFileStream::ReadByte()

     *        set txtImport::Text to string::Concat(txtImport::Text::Trim(" "), " ", b)

              compute numBytesRead = (numBytesRead + 1) end-compute

              compute numBytesToRead = (numBytesToRead - 1) end-compute

              set ls-CharsRead to numBytesRead

     *        if ls-Chars1000 = zeros

     *            set txtCharsRead::Text to numBytesRead

     *            invoke type System.Windows.Forms.Application::DoEvents()

     *        end-if

          end-perform

          set txtCharsRead::Text to numBytesRead

          set btnGo::Enabled to true

      end method.


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>