Sign in Join
Wiki copytemporary

MAC2UNIX/de: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: MAC2UNIX/de

OldNewLine
1+\
2+\
3+Zurück zur Seite [[Newline/de|Zeilenumbruch / Newline]].\
4+\
5+Das Unterprogramm konvertiert die Zeilenumbrüche einer ASCII- bzw. ANSI-Textdatei vom MAC-Format in das UNIX-Format.\
6+
7+``` pascal
8+uses
9+ FileUtil, ...;
10+
11+ ...
12+
13+procedure subMAC2UNIX(const conStrQuellDateiname, conStrZielDateiname: string);
14+// konvertiert Zeilenumbrüche von Mac OS (bis Version 9), Apple II und C64 nach
15+// Unix, Linux, Android, Mac OS X, AmigaOS, BSD, usw ...
16+var
17+ txtQuelldatei: file of char;
18+ txtZieldatei: file of char;
19+ chrZeichen: char;
20+
21+begin
22+
23+ assignfile(txtQuelldatei, UTF8ToSys(conStrQuellDateiname));
24+ assignfile(txtZieldatei, UTF8ToSys(conStrZielDateiname));
25+ Rewrite(txtZieldatei);
26+ Reset(txtQuelldatei);
27+ Reset(txtZieldatei);
28+
29+ while not EOF(txtQuelldatei) do
30+ begin
31+
32+ Read(txtQuelldatei, chrZeichen);
33+
34+ if (chrZeichen = #13) then
35+ Write(txtZieldatei, #10)
36+ else
37+ Write(txtZieldatei, chrZeichen);
38+
39+ end;
40+
41+ closefile(txtQuelldatei);
42+ closefile(txtZieldatei);
43+
44+end;
45+```
46+
47+\
48+Aufruf unter DOS, Windows:
49+
50+``` pascal
51+ subMAC2UNIX('E:\Test_alt.txt', 'E:\Test_neu.txt');
52+```
53+
54+\
55+Aufruf unter LINUX:
56+
57+``` pascal
58+ subMAC2UNIX('/home/user/Test_alt.txt', '/home/user/Test_neu.txt');
59+```
60+
61+---
62+*From the Free Pascal wiki, page "MAC2UNIX/de", as it stood on 2020-02-19 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history