Thema: Dostounix

Einzelnen Beitrag anzeigen

bernhard_LA

Registriert seit: 8. Jun 2009
Ort: Bayern
1.123 Beiträge
 
Delphi 11 Alexandria
 
#1

Dostounix

  Alt 8. Jan 2014, 12:52
Hat jemand mal ein schöne Implementierung für DOSTOUNIX ??

UNIX2DOS habe ich schon


Delphi-Quellcode:
procedure Unix2Dos(UnixTEXTFile, DosTEXTFile : String);
Const CR : Char = #13;
      LF = #10;
Var InFile, OutFile : File;
    InByte : Char;

begin
  Assign (InFile, UnixTEXTFile); ReSet (InFile, 1);
  Assign (OutFile, DosTEXTFile); ReWrite (OutFile, 1);
  while NOT EOF (InFile) do
    begin
      BlockRead (InFile, InByte, 1);
      if InByte = LF then BlockWrite (OutFile, CR, 1);
      BlockWrite (OutFile, InByte, 1);
    end;
  Close (OutFile);
  Close (InFile);
end;
  Mit Zitat antworten Zitat