Delphi-Projects

Форк
0
60 строк · 1013.0 Байт
1
program UWin;
2

3
{$APPTYPE CONSOLE}
4

5
uses
6
  SysUtils;
7

8
var
9
  f1, f2: Text;
10
  s: string;
11

12
begin
13
  if ParamCount = 0 then
14
  begin
15
    Writeln('No source file given to convert!');
16
    Halt(1);
17
  end;
18

19
  if not FileExists(ParamStr(1)) then
20
  begin
21
    Writeln('No such file exists!');
22
    Halt(2);
23
  end;
24

25
  if ParamCount = 1 then
26
  begin
27
    s := ChangeFileExt(ParamStr(1), '.BAK');
28
    RenameFile(ParamStr(1), s);
29
    AssignFile(f1, s);
30
    AssignFile(f2, ParamStr(1));
31
  end
32
  else
33
  begin
34
    s := ParamStr(2);
35
    if DirectoryExists(s) then
36
      s := IncludeTrailingPathDelimiter(s) +
37
        ExtractFileName(ParamStr(1));
38
    AssignFile(f1, ParamStr(1));
39
    AssignFile(f2, s);
40
  end;
41

42
  try
43
    Reset(f1);
44
    Rewrite(f2);
45
    while not Eof(f1) do
46
    begin
47
      ReadLn(f1, s);
48
      WriteLn(f2, RWin(TrimRight(s)));
49
    end;
50
  finally
51
    CloseFile(f1);
52
    CloseFile(f2);
53
  end;
54

55
  if ParamCount = 1 then
56
    DeleteFile(ChangeFileExt(ParamStr(1), '.BAK'))
57
  else
58
    DeleteFile(ParamStr(1));
59
  Halt(0);
60
end.
61

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.