diff --git a/docs/sysutex/Makefile b/docs/sysutex/Makefile index 6348bc03de..ab8be468b0 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 + ex37 ex38 ex39 ex40 ex41 ex42 ex43 TEXOBJECTS=$(addsuffix .tex, $(OBJECTS)) diff --git a/docs/sysutex/README b/docs/sysutex/README index ee30901b85..1084ae8839 100644 --- a/docs/sysutex/README +++ b/docs/sysutex/README @@ -37,3 +37,9 @@ 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. +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. diff --git a/docs/sysutex/ex38.pp b/docs/sysutex/ex38.pp new file mode 100644 index 0000000000..b5df7ec91f --- /dev/null +++ b/docs/sysutex/ex38.pp @@ -0,0 +1,10 @@ +Program Example38; + +{ This program demonstrates the FileExists function } + +Uses sysutils; + +Begin + If FileExists(ParamStr(0)) Then + Writeln ('All is well, I seem to exist.'); +End. \ No newline at end of file diff --git a/docs/sysutex/ex39.pp b/docs/sysutex/ex39.pp new file mode 100644 index 0000000000..3f21567729 --- /dev/null +++ b/docs/sysutex/ex39.pp @@ -0,0 +1,15 @@ +Program Example39; + +{ This program demonstrates the FileGetDate function } + +Uses sysutils; + +Var F,D : Longint; + +Begin + F:=FileCreate('test.dat'); + D:=FileGetDate(D); + Writeln ('File crerated on ',DateTimeToStr(FileDateToDateTime(D))); + FileClose(F); + DeleteFile('test.dat'); +End. \ No newline at end of file diff --git a/docs/sysutex/ex40.pp b/docs/sysutex/ex40.pp new file mode 100644 index 0000000000..7a33c34b3c --- /dev/null +++ b/docs/sysutex/ex40.pp @@ -0,0 +1,38 @@ +Program Example40; + +{ This program demonstrates the FileGetAttr function } + +Uses sysutils; + +Procedure Testit (Name : String); + +Var F : Longint; + +Begin + F:=FileGetAttr(Name); + If F<>-1 then + begin + Writeln ('Testing : ',Name); + If (F and faReadOnly)<>0 then + Writeln ('File is ReadOnly'); + If (F and faHidden)<>0 then + Writeln ('File is hidden'); + If (F and faSysFile)<>0 then + Writeln ('File is a system file'); + If (F and faVolumeID)<>0 then + Writeln ('File is a disk label'); + If (F and faArchive)<>0 then + Writeln ('File is artchive file'); + If (F and faDirectory)<>0 then + Writeln ('File is a directory'); + end + else + Writeln ('Error reading attribites of ',Name); +end; + +begin + testit ('ex40.pp'); + testit (ParamStr(0)); + testit ('.'); + testit ('/'); +End. \ No newline at end of file diff --git a/docs/sysutex/ex41.pp b/docs/sysutex/ex41.pp new file mode 100644 index 0000000000..bd34c14f87 --- /dev/null +++ b/docs/sysutex/ex41.pp @@ -0,0 +1,18 @@ +Program Example41; + +{ Program to demonstrate the FileSearch function. } + +Uses Sysutils; + +Const +{$ifdef linux} + FN = 'find'; + P = '.:/bin:/usr/bin'; +{$else} + FN = 'find.exe'; + P = 'c:\dos;c:\windows;c:\windows\system;c:\windows\system32'); +{$endif} + +begin + Writeln ('find is in : ',FileSearch (FN,P)); +end. diff --git a/docs/sysutex/ex42.pp b/docs/sysutex/ex42.pp new file mode 100644 index 0000000000..70321d25b8 --- /dev/null +++ b/docs/sysutex/ex42.pp @@ -0,0 +1,12 @@ +Program Example42; + +{ This program demonstrates the FileSetAttr function } + +Uses sysutils; + +Begin + If FileSetAttr ('ex40.pp',faReadOnly or faHidden)=0 then + Writeln ('Successfully made file hidden and read-only.') + else + Writeln ('Coulnd''t make file hidden and read-only.'); +End. \ No newline at end of file diff --git a/docs/sysutex/ex43.pp b/docs/sysutex/ex43.pp new file mode 100644 index 0000000000..0a0af064cb --- /dev/null +++ b/docs/sysutex/ex43.pp @@ -0,0 +1,23 @@ +Program Example43; + +{ This program demonstrates the FindFirst function } + +Uses sysutils; + +Var Info : TSearchRec; + Count : Longint; + +Begin + Count:=0; + If FindFirst ('*.pp',faAnyFile,Info)=0 then + begin + Repeat + Inc(Count); + With Info do + Writeln (Name:40,Size:15); + Until FindNext(info)<>0; + end; + FindClose(Info); + Writeln ('Finished search. Found ',Count,' matches'); + +End. \ No newline at end of file