.


:




:

































 

 

 

 


if Ini.ValueExists('My Section','MyKey') then

2

PASCAL

12


: ..,

. .2. Pascal. 12

2007.


12

PASCAL

.

: Object Pascal; Ini .

 

: , .

:

  1. .

a. .

b. ( ).

  1. .
  2. .

AssignFile (var F: < >; FileName: string), FileName F.

:

var FText: TextFile; { }

FTip: File of integer; { }

FNotTip: File; { }

Begin

AssignFile(FText,c:\result.txt);

AssignFile(FTip,c:\int.dat);

AssignFile(FNotTip,c:\data.dat);

...

, . Object Pascal TextFile, :

var < >: TextFile;

/. - Read, Readln, Write Writeln.

Append (var F: TextFile) - , F, .

 

ChDir(S: string) - S.

CloseFile(Var F) - , F.

Eof(var F): Boolean - true , F.

Eoln(var F: Text): Boolean - (true) , F.

Erase(var F) - , F.

FilePos(var F): Longint - , F. , - 0.

FileSize(var F):Integer - , F. .

Flush(var F: Text) - , F.

GetDir - S - , D, : 0 - , 1 - A, 2 - B, 3 - C .. S , , "c:\mydir".

IOResult: Integer - , /.

MkDir(S: String) - , S.

Read(F, < >) - , F, .

Readln(var F: Text; < >) - , F.

Rename(var F; Newname) - , F, Newname. , Newname .

Reset(var F [: File;RecSize: Word]) - , F. RecSize ( 128).

Rewrite(var F: File [; Recsize:Word]) - , F. RecSize ( 128).

RmDir(S: String) - , S.

Seek(var F; N: Longint) - , F, N. .

SeekEof (Var F: Text): Boolean - true , F.

SeekEoln (Var F: Text): Boolean - true , F.

SetTextBuf(Var F: Text; Var Buf [; Size: Integer]) - / Buf Size ( ) , F.

Truncate(var F) - , F, .

Write(var F; < >) - , F.

Writeln(var F: Text;< >) - , F.

, . :

var < >: file of < >;

:

var F: file of real;

Read Write . , Readln Writeln, . Seek, , , . FilePos, .

- , . , .

:

var < >: file;

Reset Rewrite, , . Read Write BlockRead BlockWrite, .

BlockRead (var F: File; var Buf; Count: Integer [; var Result: Integer]) - Count , F, Buf. Result, .

BlockWrite (var F: File; var Buf; Count: Integer [; var Result: Integer]) - Count Buf , F. Result, .

Ini

.INI - , 16- Windows 3.x . , , . , [Desktop]. , , , :

<>=<>

WIN.INI

[windows]

run=

NullPort=None

load=essdaemn.exe hpljsw.exe

device=Epson LX-100,EPSON9,LPT1:

 

[Desktop]

Wallpaper=(None)

TileWallpaper=0

WallpaperStyle=0

Pattern=()

 

[Intl]

iCountry=7

ICurrDigits=0

iCurrency=1

...

Windows 95 NT .INI TIniFile, , TRegistry, TRegIniFile TRegistryIniFile, - registry.

TIniFile, FileName , . TIniFile .INI, , .

.INI, , Windows, GetWindowsDirectory(Buffer, Size).

GetWindowsDirectory Windows. Windows, .ini .hlp. . , , , , HOMEPATH. .

Buffer , . "\", Windows .

Size . MAX_PATH.

Buffer , . , Size, .

, . , GetLastError.

Windows WIN95 C,

var APchar:array[0..254] of char;

...

GetWindowsDirectory(APchar,255);

APchar : C:\WIN95. Windows , C:\.

Ini TIniFile My.ini:

var Ini:TIniFile;

...

Ini:=TIniFile.Create('MY.INI');

My Section, MyKey:

 

if Ini.ValueExists('My Section','MyKey') then...

MyKey My Section '5':

Ini.WriteInteger('My Section','MyKey',5);

MyKey My Section:

Ini.DeleteKey('My Section','MyKey');

Ini Ini:

Ini.UpdateFile;

Ini.Free;

 

1. , , .

2. , ( ).

3. , ( ).

4. , Ini-( ) .

 

 

1. ? ?

2. ?

3. ?

4. ?

5. -?

6. ini-? ?

 



<== | ==>
1. | ()
:


: 2016-09-03; !; : 324 |


:

:

- - , .
==> ...

2043 - | 1981 -


© 2015-2024 lektsii.org - -

: 0.038 .