Difference between revisions of "MAC2UNIX/de"
From Free Pascal wiki
Jump to navigationJump to searchm |
|||
Line 57: | Line 57: | ||
<br> | <br> | ||
--[[User:Olaf|Olaf]] 07:40, 24 August 2013 (CEST) | --[[User:Olaf|Olaf]] 07:40, 24 August 2013 (CEST) | ||
− | [[Category:Code | + | |
+ | |||
+ | {{AutoCategory}} | ||
+ | [[Category:Code Snippets/de]] |
Revision as of 00:37, 30 October 2015
│
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');
--Olaf 07:40, 24 August 2013 (CEST)