mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 18:49:24 +02:00
49 lines
1000 B
ObjectPascal
49 lines
1000 B
ObjectPascal
Program TestStream;
|
|
|
|
{
|
|
When testing, remember to send something through standard input !!
|
|
}
|
|
|
|
uses sysutils,classes,iostream;
|
|
|
|
Var Stream : TIOStream;
|
|
S,T : String;
|
|
i : longint;
|
|
SS : ShortString;
|
|
|
|
begin
|
|
S:='ABCDEFGHIJKLMNOPQRSTUVWXYZ %d'#10;
|
|
T:=S;
|
|
Writeln ('Creating output stream.');
|
|
Stream:=TIOStream.Create(iosOutPut);
|
|
For I:=1 to 10 do
|
|
begin
|
|
S:=Format(T,[I]);
|
|
Stream.WriteBuffer (S[1],Length(S));
|
|
end;
|
|
Stream.Free;
|
|
Writeln ('Creating error stream.');
|
|
Stream:=TIOStream.Create(iosError);
|
|
For I:=1 to 10 do
|
|
begin
|
|
S:=Format(T,[I]);
|
|
Stream.WriteBuffer (S[1],Length(S));
|
|
end;
|
|
Stream.Free;
|
|
Writeln ('Creating input stream');
|
|
Stream:=TIOStream.Create(iosInput);
|
|
SS:='aha';
|
|
While Length(SS)>0 do
|
|
begin
|
|
SetLength(SS,Stream.Read(SS[1],255));
|
|
Write(SS);
|
|
end;
|
|
Writeln ('Read ',Stream.Position,' bytes.');
|
|
Stream.Free;
|
|
end.
|
|
$Log$
|
|
Revision 1.3 2002-09-07 15:15:28 peter
|
|
* old logs removed and tabs fixed
|
|
|
|
}
|