Home  |  Delphi .net Home  |  System.IO.BufferedStream  |  WriteByte Method
  
WriteByte  
Method  
Write a single Byte to the current stream position
BufferedStream Class
System.IO NameSpace
NotCF1.  Procedure WriteByte ( Value : Byte ) ;
CF : Methods with this mark are Compact Framework Compatible
Description
The Byte Value is written to the current stream position. The stream position is updated accordingly.
Microsoft MSDN Links
System.IO
System.IO.BufferedStream
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

uses
  System.IO;

var
  Memory    : System.IO.MemoryStream;
  Stream    : System.IO.BufferedStream;
  ByteAsInt : Integer;

begin
  // Create our memory stream
  Memory := System.IO.MemoryStream.Create;

  // Create out BufferedStream to access this memory stream
  Stream := System.IO.BufferedStream.Create(Memory);

  // Read and write to the memory stream using the BufferedStream
  Stream.WriteByte(1);
  Stream.WriteByte(2);
  Stream.WriteByte(3);

  // Now seek to the start of the stream
  Stream.Seek(0, SeekOrigin.Begin);

  // Now display the contents
  ByteAsInt := Stream.ReadByte;

  while ByteAsInt > 0 do
  begin
    Console.WriteLine(ByteAsInt.ToString);
    ByteAsInt := Stream.ReadByte;
  end;

  // Close the stream
  Stream.Close;

  Console.Readline;
end.
   1
   2
   3
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author