diff --git a/.gitattributes b/.gitattributes index 8eabacfa8d..7604e68691 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/packages/fcl-base/examples/README.txt b/packages/fcl-base/examples/README.txt index 420d1bdb85..e42bc8ee20 100644 --- a/packages/fcl-base/examples/README.txt +++ b/packages/fcl-base/examples/README.txt @@ -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. \ No newline at end of file diff --git a/packages/fcl-base/examples/demoio.pp b/packages/fcl-base/examples/demoio.pp new file mode 100644 index 0000000000..9270b1d61e --- /dev/null +++ b/packages/fcl-base/examples/demoio.pp @@ -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. \ No newline at end of file