Sign in Join
Wiki copytemporary

UNIX2DOS/de: what changed

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

Title: UNIX2DOS/de

OldNewLine
1+Zurück zur Seite [[Newline/de|Zeilenumbruch / Newline]].
2+
3+Das Unterprogramm konvertiert die Zeilenumbrüche einer ASCII- bzw. ANSI-Textdatei vom UNIX-Format in das DOS-Format.
4+
5+``` pascal
6+uses
7+ FileUtil, ...;
8+
9+ ...
10+
11+procedure subUnix2Dos(const conStrQuellDateiname, conStrZielDateiname: string);
12+// konvertiert Zeilenumbrüche von Unix, Linux, Android, Mac OS X, AmigaOS, BSD usw. nach
13+// Windows, DOS, OS/2, CP/M oder TOS (Atari)
14+var
15+ txtQuelldatei: file of char;
16+ txtZieldatei: file of char;
17+ chrZeichen: char;
18+
19+begin
20+
21+ assignfile(txtQuelldatei, UTF8ToSys(conStrQuellDateiname));
22+ assignfile(txtZieldatei, UTF8ToSys(conStrZielDateiname));
23+ Rewrite(txtZieldatei);
24+ Reset(txtQuelldatei);
25+ Reset(txtZieldatei);
26+
27+ while not EOF(txtQuelldatei) do
28+ begin
29+
30+ Read(txtQuelldatei, chrZeichen);
31+
32+ if (chrZeichen = #10) then
33+ begin
34+ Write(txtZieldatei, #13);
35+ Write(txtZieldatei, chrZeichen);
36+ Continue;
37+ end;
38+
39+ Write(txtZieldatei, chrZeichen);
40+
41+ end;
42+
43+ closefile(txtQuelldatei);
44+ closefile(txtZieldatei);
45+
46+end;
47+```
48+
49+Aufruf unter DOS, Windows:
50+
51+``` pascal
52+ subUnix2Dos('E:\Test_alt.txt', 'E:\Test_neu.txt');
53+```
54+
55+Aufruf unter Linux :
56+
57+``` pascal
58+ subUnix2Dos('/home/user/Test_alt.txt', '/home/user/Test_neu.txt');
59+```
60+
61+---
62+*From the Free Pascal wiki, page "UNIX2DOS/de", as it stood on 2020-03-03 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