UNIX2MAC/de

From Free Pascal wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Deutsch (de)


Zurück zur Seite Zeilenumbruch / Newline.


Das Unterprogramm konvertiert die Zeilenumbrüche einer ASCII- bzw. ANSI-Textdatei vom UNIX-Format in das MAC-Format.

uses
  FileUtil, ...;

  ...

procedure subUNIX2MAC(const conStrQuellDateiname, conStrZielDateiname: string);
// konvertiert Zeilenumbrüche von Unix, Linux, Android, Mac OS X, AmigaOS, BSD, usw. ... nach
// Mac OS (bis Version 9), Apple II und C64
var
  txtQuelldatei: file of char;
  txtZieldatei: file of char;
  chrZeichen: char;

begin

  assignfile(txtQuelldatei, UTF8ToSys(conStrQuellDateiname));
  assignfile(txtZieldatei, UTF8ToSys(conStrZielDateiname));
  Rewrite(txtZieldatei);
  Reset(txtQuelldatei);
  Reset(txtZieldatei);

  while not EOF(txtQuelldatei) do
  begin

    Read(txtQuelldatei, chrZeichen);

    if (chrZeichen = #10) then
      Write(txtZieldatei, #13)
    else
      Write(txtZieldatei, chrZeichen);

  end;

  closefile(txtQuelldatei);
  closefile(txtZieldatei);

end;

Aufruf unter DOS, Windows:

  subUNIX2MAC('E:\Test_alt.txt', 'E:\Test_neu.txt');

Aufruf unter Linux:

  subUNIX2MAC('/home/user/Test_alt.txt', '/home/user/Test_neu.txt');