Difference between revisions of "MAC2UNIX/de"

From Lazarus wiki
Jump to navigationJump to search
m (Fixed syntax highlighting; deleted category included in page template)
 
Line 5: Line 5:
 
<br>
 
<br>
 
Das Unterprogramm konvertiert die Zeilenumbrüche einer ASCII- bzw. ANSI-Textdatei vom MAC-Format in das UNIX-Format.<br>
 
Das Unterprogramm konvertiert die Zeilenumbrüche einer ASCII- bzw. ANSI-Textdatei vom MAC-Format in das UNIX-Format.<br>
<syntaxhighlight>
+
 
 +
<syntaxhighlight lang=pascal>
 
uses
 
uses
 
   FileUtil, ...;
 
   FileUtil, ...;
Line 46: Line 47:
 
<br>
 
<br>
 
Aufruf unter DOS, Windows:
 
Aufruf unter DOS, Windows:
<syntaxhighlight>
+
<syntaxhighlight lang=pascal>
 
   subMAC2UNIX('E:\Test_alt.txt', 'E:\Test_neu.txt');
 
   subMAC2UNIX('E:\Test_alt.txt', 'E:\Test_neu.txt');
 
</syntaxhighlight>
 
</syntaxhighlight>
 
<br>
 
<br>
 
Aufruf unter LINUX:
 
Aufruf unter LINUX:
<syntaxhighlight>
+
<syntaxhighlight lang=pascal>
 
   subMAC2UNIX('/home/user/Test_alt.txt', '/home/user/Test_neu.txt');
 
   subMAC2UNIX('/home/user/Test_alt.txt', '/home/user/Test_neu.txt');
 
</syntaxhighlight>
 
</syntaxhighlight>
<br>
 
<br>
 
--[[User:Olaf|Olaf]] 07:40, 24 August 2013 (CEST)
 
 
 
{{AutoCategory}}
 
[[Category:Code Snippets/de]]
 

Latest revision as of 07:04, 19 February 2020

Deutsch (de)


Zurück zur Seite Zeilenumbruch / Newline.

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

uses
  FileUtil, ...;

  ...

procedure subMAC2UNIX(const conStrQuellDateiname, conStrZielDateiname: string);
// konvertiert Zeilenumbrüche von Mac OS (bis Version 9), Apple II und C64 nach
// Unix, Linux, Android, Mac OS X, AmigaOS, BSD, usw ...
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 = #13) then
      Write(txtZieldatei, #10)
    else
      Write(txtZieldatei, chrZeichen);

  end;

  closefile(txtQuelldatei);
  closefile(txtZieldatei);

end;


Aufruf unter DOS, Windows:

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


Aufruf unter LINUX:

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