mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 12:09:30 +02:00
* Added simple example for AssignStream
git-svn-id: trunk@42123 -
This commit is contained in:
parent
f515c70a40
commit
205be75320
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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.
|
27
packages/fcl-base/examples/demoio.pp
Normal file
27
packages/fcl-base/examples/demoio.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user