diff --git a/docs/sysutex/Makefile b/docs/sysutex/Makefile index ab8be468b0..dae0857606 100644 --- a/docs/sysutex/Makefile +++ b/docs/sysutex/Makefile @@ -35,7 +35,7 @@ endif OBJECTS=ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 ex11 ex12\ ex13 ex14 ex15 ex16 ex17 ex18 ex19 ex20 ex21 ex22 ex23 ex24\ ex25 ex26 ex27 ex28 ex29 ex30 ex31 ex32 ex33 ex34 ex35 ex36\ - ex37 ex38 ex39 ex40 ex41 ex42 ex43 + ex37 ex38 ex39 ex40 ex41 ex42 ex43 ex44 ex45 ex46 ex47 TEXOBJECTS=$(addsuffix .tex, $(OBJECTS)) diff --git a/docs/sysutex/README b/docs/sysutex/README index 1084ae8839..0d86375489 100644 --- a/docs/sysutex/README +++ b/docs/sysutex/README @@ -6,7 +6,7 @@ ex3.pp contains an example of the DateTimeToStr function. ex4.pp contains an example of the DateTimeToString function. ex5.pp contains an example of the DateTimeToSystemTime function. ex7.pp contains an example of the DateToStr function. -exex8.pp contains an example of the DayOfWeek function. +ex8.pp contains an example of the DayOfWeek function. ex9.pp contains an example of the DecodeDate function. ex10.pp contains an example of the DecodeTime function. ex11.pp contains an example of the EncodeDate function. @@ -37,9 +37,13 @@ ex34.pp contains an example of the ExtractFileName function. ex35.pp contains an example of the ExtractRelativePath function. ex36.pp contains an example of the FileAge function. ex37.pp contains an example of the FileCreate function. -exex38.pp contains an example of the FileExists function. +ex38.pp contains an example of the FileExists function. ex39.pp contains an example of the FileGetDate function. ex40.pp contains an example of the FileGetAttr function. ex41.pp contains an example of the FileSearch function. ex42.pp contains an example of the FileSetAttr function. ex43.pp contains an example of the FindFirst function. +ex44.pp contains an example of the RenameFile function. +ex45.pp contains an example of the GetDirs function. +ex46.pp contains an example of the StrBufSize function. +ex47.pp contains an example of the SetDirSeparators function. diff --git a/docs/sysutex/ex37.pp b/docs/sysutex/ex37.pp index 00b52819b5..88648c0c49 100644 --- a/docs/sysutex/ex37.pp +++ b/docs/sysutex/ex37.pp @@ -20,12 +20,17 @@ Begin If J<>I then Writeln ('Mismatch at file position ',I) end; - FileSeek(F,0,0); + FileSeek(F,0,fsFromBeginning); Randomize; Repeat - FileSeek(F,Random(100)*4,0); + FileSeek(F,Random(100)*4,fsFromBeginning); FileRead (F,J,SizeOf(J)); Writeln ('Random read : ',j); Until J>80; FileClose(F); + F:=FileOpen('test.dat',fmOpenWrite); + I:=50*SizeOf(Longint); + If FileTruncate(F,I) then + Writeln('SuccessFully truncated file to ',I,' bytes.'); + FileClose(F); End. \ No newline at end of file diff --git a/docs/sysutex/ex44.pp b/docs/sysutex/ex44.pp new file mode 100644 index 0000000000..405b3f0175 --- /dev/null +++ b/docs/sysutex/ex44.pp @@ -0,0 +1,17 @@ +Program Example44; + +{ This program demonstrates the RenameFile function } + +Uses sysutils; + +Var F : Longint; + S : String; + +Begin + S:='Some short file.'; + F:=FileCreate ('test.dap'); + FileWrite(F,S[1],Length(S)); + FileClose(F); + If RenameFile ('test.dap','test.dat') then + Writeln ('Successfully renamed files.'); +End. \ No newline at end of file diff --git a/docs/sysutex/ex45.pp b/docs/sysutex/ex45.pp new file mode 100644 index 0000000000..a4761fd44b --- /dev/null +++ b/docs/sysutex/ex45.pp @@ -0,0 +1,22 @@ +Program Example45; + +{ This program demonstrates the GetDirs function } +{$H+} + +Uses sysutils; + +Var Dirs : Array[0..127] of pchar; + I,Count : longint; + Dir,NewDir : String; + +Begin + Dir:=GetCurrentDir; + Writeln ('Dir : ',Dir); + NewDir:=''; + count:=GetDirs(Dir,Dirs); + For I:=0 to Count do + begin + NewDir:=NewDir+'/'+StrPas(Dirs[I]); + Writeln (NewDir); + end; +End. \ No newline at end of file diff --git a/docs/sysutex/ex46.pp b/docs/sysutex/ex46.pp new file mode 100644 index 0000000000..73be903386 --- /dev/null +++ b/docs/sysutex/ex46.pp @@ -0,0 +1,18 @@ +Program Example46; + +{ This program demonstrates the StrBufSize function } +{$H+} + +Uses sysutils; + +Const S = 'Some nice string'; + +Var P : Pchar; + +Begin + P:=StrAlloc(Length(S)+1); + StrPCopy(P,S); + Write (P, ' has length ',length(S)); + Writeln (' and buffer size ',StrBufSize(P)); + StrDispose(P); +End. \ No newline at end of file diff --git a/docs/sysutex/ex47.pp b/docs/sysutex/ex47.pp new file mode 100644 index 0000000000..e11f0e21fd --- /dev/null +++ b/docs/sysutex/ex47.pp @@ -0,0 +1,9 @@ +Program Example47; + +{ This program demonstrates the SetDirSeparators function } + +Uses sysutils; + +Begin + Writeln (SetDirSeparators('/pp\bin/win32\ppc386')); +End. \ No newline at end of file