OEM2Ansi/de: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | - | ||
| 2 | 1 | Zurück zur Seite [[code examples/de|Code Beispiele]].\ | |
| 3 | - | ||
| 2 | + | ||
| 4 | 3 | Dieser Artikel beschäftigt sich mit der Windowsprogrammierung.\ | |
| 5 | 4 | Das Unterprogramm konvertiert eine Datei vom OEM-Zeichensatz (DOS und Windowskonsole) in den ANSI-Zeichensatz.\ | |
| 6 | 5 | ||
| 7 | 6 | ``` pascal | |
| 8 | 7 | uses | |
| 9 | 8 | Windows, FileUtil, Classes, SysUtils, ...; | |
| 10 | 9 | ||
| 11 | 10 | ... | |
| 12 | 11 | ||
| 13 | 12 | procedure subOEM2Ansi(const conStrQuellDateiname, conStrZielDateiname: string); | |
| 14 | 13 | // konvertiert eine Datei mit Ansi-Zeichensatz in den OEM-Zeichensatz | |
| 15 | 14 | var | |
| 16 | 15 | txtQuelldatei: file of char; | |
| 17 | 16 | txtZieldatei: file of char; | |
| 18 | 17 | chrZeichen: char; | |
| 19 | 18 | strPuffer: string; | |
| 20 | 19 | ||
| 21 | 20 | begin | |
| 22 | 21 | ||
| 23 | 22 | assignfile(txtQuelldatei, UTF8ToSys(conStrQuellDateiname)); | |
| 24 | 23 | assignfile(txtZieldatei, UTF8ToSys(conStrZielDateiname)); | |
| 25 | 24 | Rewrite(txtZieldatei); | |
| 26 | 25 | Reset(txtQuelldatei); | |
| 27 | 26 | Reset(txtZieldatei); | |
| 28 | 27 | ||
| 29 | 28 | while not EOF(txtQuelldatei) do | |
| 30 | 29 | begin | |
| 31 | 30 | ||
| 32 | 31 | Read(txtQuelldatei, chrZeichen); | |
| 33 | 32 | strPuffer := chrZeichen; | |
| 34 | 33 | // Übersetzt den Zeichensatz OEM in den Zeichensatz Ansi | |
| 35 | 34 | OemToCharBuff(PChar(strPuffer), PChar(strPuffer), Length(strPuffer)); | |
| 36 | 35 | Write(txtZieldatei, char(strPuffer[1])); | |
| 37 | 36 | ||
| 38 | 37 | end; | |
| 39 | 38 | ||
| 40 | 39 | closefile(txtQuelldatei); | |
| 41 | 40 | closefile(txtZieldatei); | |
| 42 | 41 | ||
| 43 | 42 | end; | |
| 44 | 43 | ``` | |
| 45 | 44 | ||
| 46 | - | ||
| 47 | 45 | Aufruf unter Windows: | |
| 48 | 46 | ||
| 49 | 47 | ``` pascal | |
| 50 | 48 | subOEM2Ansi('E:\Test_alt.txt', 'E:\Test_neu.txt'); | |
| 51 | 49 | ``` | |
| 52 | 50 | ||
| 53 | 51 | --- | |
| 54 | 52 | *From the Free Pascal wiki, page "OEM2Ansi/de", as it stood on 2020-02-21 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).* |
