{08.06.04 Авторы: Касимов Вениамин, Анисимов Василий программа создает таблицу со списком фильмов в html } const NameHtml = 'html\test.html'; {путь конечного файла} NameFtpList = 'base\ftpdir\ftpdir.txt'; {путь списка файла} NameDataBase = 'base\database\'; {путь файлов с описанием} var ou:text; {выходной файл} iu:text; {списковый файл} fd:text; {файл описания} NameOfDes: string; {имя описания} NameVideo: string; {имя} OrgNameVideo: string; {оригинальное имя} YearEx: string; {дата выхода} procedure HtmlP1; {создание заголовка списка и запись его в файл} begin assign(ou,NameHtml); rewrite(ou); writeln(ou,''); writeln(ou,''); writeln(ou,''); writeln(ou,'Test File'); writeln(ou,''); writeln(ou,''); writeln(ou,''); writeln(ou,''); writeln(ou,''); writeln(ou,''); writeln(ou,''); writeln(ou,''); writeln(ou,''); close(ou); end; procedure HtmlP2; {заполнение таблици} begin Append(ou); writeln(ou,''); writeln(ou,''); writeln(ou,''); writeln(ou,''); writeln(ou,''); Close(ou); end; procedure HtmlP3; {завершение создания списка в файле} begin Append(ou); writeln(ou,'
NameOriginal NameYear of an exit
',NameVideo,'',OrgNameVideo,'',YearEx,'
'); writeln(ou,''); writeln(ou,''); Close(ou); end; function check : boolean; {поверка наличия файла описания на HDD} begin NameOfDes:=NameDataBase + NameOfDes+'.txt'; assign(fd,NameOfDes); {$I-} reset(fd); {$I+} check:= (IOResult=0); end; procedure search; var s, s1 : String; i, j, ccode : Integer; v : LongInt; code : boolean; begin assign(iu,NameFtpList); reset(iu); While not eof(iu) do begin ReadLn(iu, s); i := 2; code := true; While (i <= length(s)) and (code) do begin if (s[i-1] = ' ') and ((s[i] >= '0') or (s[i] <= '9')) then begin j := i; While s[j] <> ' ' do inc(j); if (j-i=9) then code := false; end; inc(i); end; dec(i); if not code then begin {==========================} val(copy(s, i, j-i), v, ccode); v := trunc (v/1024); str(v, NameOfDes); {==========================} if check then begin assign(fd,NameOfDes); reset(fd); ReadLn(fd, s1); v:=pos(':', s1); inc(v,2); NameVideo := copy(s1, v, length(s1)); ReadLn(fd, s1); v:=pos(':', s1); inc(v,2); OrgNameVideo := copy(s1, v, length(s1)); ReadLn(fd, s1); v:=pos(':', s1); inc(v,2); YearEx := copy(s1, v, length(s1)); Close(fd); end else begin NameVideo:= 'N/A'; OrgNameVideo:= 'N/A'; YearEx:= 'N/A'; end; HtmlP2; end; {if not code} end; {While not eof(iu) } end; {procedure search} Begin HtmlP1; search; HtmlP3; End.