Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function ChoosePath() : String;
- Var
- Path : String;
- IsCorrect : Boolean;
- InputFile : TextFile;
- Begin
- Begin
- Repeat
- Writeln('Введите путь к файлу для ввода информации: ');
- IsCorrect := True;
- Readln(Path);
- Try
- AssignFile(InputFile, Path);
- Reset(InputFile);
- Except
- IsCorrect := False;
- End;
- If (Not IsCorrect) Or (Length(Path) < 5) Then
- Begin
- IsCorrect := False;
- Writeln('Ошибка ввода! Повторите попытку.');
- End
- Else
- Begin
- If ((Path[High(Path)] <> 't') And (Path[High(Path) - 1] <> 'x') And (Path[High(Path) - 2] <> 't') And (Path[High(Path) - 3] <> '.')) Then
- Begin
- IsCorrect := False;
- Writeln('Ошибка ввода! Повторите попытку.');
- End;
- End;
- Until IsCorrect;
- End;
- CloseFile(InputFile);
- ChoosePath := Path;
- End;
- Function InputStringFromFile() : Integer;
- Var
- InputFile : TextFile;
- IsCorrect : Boolean;
- Path : String;
- Str : String;
- Begin
- Path := ChoosePath();
- Writeln('Запись размера...');
- AssignFile(InputFile, Path);
- Reset(InputFile);
- Readln(InputFile, Str);
- CloseFile(InputFile);
- InputStringFromFile := Str;
- End;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement