Dodatkowy plik tekstowy

0

Witam. Otóż mam pewien problem z pascalem - mam dodatkowy plik tekstowy ktory zawiera m.in funkcje zamiany słów, przykład

  slowo := StringReplace(linia, 'szukane slowo', 'zastapione slowo', [rfReplaceAll]); 

i chciałbym aby mój główny program używał tego pliku tekstowego jak swojego kodu źródłowego (czyli tak jakby zamiast pisac 20 funkcji string replace w kodzie źródłowym to chciałbym je przenieść do osobnego pliku źródłowego, aby było czytelniej.
Pewna część kodu źródłowego wyglada tak:

 
 repeat 
ReadLn(plikens, linia);

{TUTAJ CHCIALBYM POBIERAC TEKST Z MOJEGO PLIKU DODATKOWEGO}

 append(plikensior2);    
         WriteLn(plikensior2, linia);


   until eof(plikens);  
0

chodzi mi o coś w stylu include w php

0

Napisałeś tak, że nie mogę zrozumieć o co chodzi. Za pewne wystarczył by osobny moduł (unit) z deklaracją funkcji w sekcji interface oraz jej kodem w sekcji implementation. Jeżeli tego nie ogarniasz, polecam zapoznać się najpierw z kursami, omawiającymi podstawy języka.

2

Delphi help system

Include file
Type	Parameter
Syntax	{$I filename}
{$INCLUDE filename}
Scope	Local
Remarks

The $I parameter directive instructs the compiler to include the named file in the compilation. In effect, the file is inserted in the compiled text right after the {$I filename} directive. The default extension for filename is .pas. If filename does not specify a directory path, then, in addition to searching for the file in the same directory as the current module, Delphi searches in the directories specified in the Search path input box on the Directories/Conditionals page of the Project|Options dialog box (or in the directories specified in a -I option on the DCC32 command line).

To specify a filename that includes a space, surround the file name with single quotation marks: {$I 'My file'}.
There is one restriction to the use of include files: An include file can't be specified in the middle of a statement part. In fact, all statements between the begin and end of a statement part must exist in the same source file.

1 użytkowników online, w tym zalogowanych: 0, gości: 1