Description |
The byte at the current position in the current Memory Stream is returned as an Integer. If the stream was already exhausted, then -1 is returned.
|
|
Microsoft MSDN Links |
System.IO
System.IO.MemoryStream
|
|
|
A simple example |
program Project1;
{$APPTYPE CONSOLE}
uses
System.IO;
var
Memory : System.IO.MemoryStream;
ByteAsInteger : Integer;
begin
// Create our Memory Stream Writer
Memory := System.IO.MemoryStream.Create;
// Write to the stream
Memory.WriteByte(1);
Memory.WriteByte(2);
Memory.WriteByte(3);
// Position at the start of the stream
Memory.Seek(0, SeekOrigin.Begin);
// Now display the stream contents
ByteAsInteger := Memory.ReadByte;
while ByteAsInteger >= 0 do
begin
Console.WriteLine(ByteAsInteger.ToString);
ByteAsInteger := Memory.ReadByte;
end;
// Close the stream
Memory.Close;
Console.Readline;
end.
| Show full unit code | 1
2
3
|
|
|
|