* Added simple example for AssignStream

git-svn-id: trunk@42123 -
This commit is contained in:
michael 2019-05-25 15:55:43 +00:00
parent f515c70a40
commit 205be75320
3 changed files with 29 additions and 0 deletions

1
.gitattributes vendored
View File

@ -1940,6 +1940,7 @@ packages/fcl-base/examples/databom.txt svneol=native#text/plain
packages/fcl-base/examples/dbugsrv.pp svneol=native#text/plain
packages/fcl-base/examples/debugtest.pp svneol=native#text/plain
packages/fcl-base/examples/decodeascii85.pp svneol=native#text/plain
packages/fcl-base/examples/demoio.pp svneol=native#text/plain
packages/fcl-base/examples/dobserver.pp svneol=native#text/plain
packages/fcl-base/examples/doecho.pp svneol=native#text/plain
packages/fcl-base/examples/dparser.pp svneol=native#text/plain

View File

@ -77,3 +77,4 @@ testini.pp Test/Demo for inifiles, ReadSectionValues.
contit.pp Test/Demo for iterators in contnr.pp
csvbom.pp Test/Demo for BOM detection in CSV document. (needs databom.txt)
testappexit.pp Test/Demo for TApplication exit code handling. (ExitCode and ExceptionExitcode)
demoio.pp Demo for AssignStream from streamio unit.

View File

@ -0,0 +1,27 @@
program demoio;
{$mode objfpc}
{$h+}
uses streamio, classes;
Var
S : TStringStream;
F : Text;
a,b,c : Integer;
begin
a:=1;
b:=2;
c:=a+b;
S:=TStringStream.Create('');
try
AssignStream(F,S);
Rewrite(F);
Writeln(F,'Hello World !');
Writeln(F,a:3,b:3,c:3);
CloseFile(F);
Writeln(S.DataString);
finally
S.Free;
end;
end.