mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-06 17:56:01 +02:00
Added ex 44-47 and changed ex37
This commit is contained in:
parent
af73412d2b
commit
e7f0f99c7e
@ -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))
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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.
|
17
docs/sysutex/ex44.pp
Normal file
17
docs/sysutex/ex44.pp
Normal file
@ -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.
|
22
docs/sysutex/ex45.pp
Normal file
22
docs/sysutex/ex45.pp
Normal file
@ -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.
|
18
docs/sysutex/ex46.pp
Normal file
18
docs/sysutex/ex46.pp
Normal file
@ -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.
|
9
docs/sysutex/ex47.pp
Normal file
9
docs/sysutex/ex47.pp
Normal file
@ -0,0 +1,9 @@
|
||||
Program Example47;
|
||||
|
||||
{ This program demonstrates the SetDirSeparators function }
|
||||
|
||||
Uses sysutils;
|
||||
|
||||
Begin
|
||||
Writeln (SetDirSeparators('/pp\bin/win32\ppc386'));
|
||||
End.
|
Loading…
Reference in New Issue
Block a user