Ansi2OEM/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 Ansi-Zeichensatz in den OEM-Zeichensatz (DOS und Windowskonsole).\ | |
| 6 | 5 | ||
| 7 | 6 | ``` pascal | |
| 8 | 7 | uses | |
| 9 | 8 | Windows, FileUtil, ...; | |
| 10 | 9 | ||
| 11 | 10 | ... | |
| 12 | 11 | ||
| 13 | 12 | procedure subAnsi2OEM(const conStrQuellDateiname, conStrZielDateiname: string); | |
| 14 | 13 | ||
| 15 | 14 | implementation | |
| 16 | 15 | ||
| 17 | 16 | procedure subAnsi2OEM(const conStrQuellDateiname, conStrZielDateiname: string); | |
| 18 | 17 | // konvertiert eine Datei mit Ansi-Zeichensatz in den OEM-Zeichensatz | |
| 19 | 18 | var | |
| 20 | 19 | txtQuelldatei: file of char; | |
| 21 | 20 | txtZieldatei: file of char; | |
| 22 | 21 | chrZeichen: char; | |
| 23 | 22 | strPuffer: string; | |
| 24 | 23 | ||
| 25 | 24 | begin | |
| 26 | 25 | ||
| 27 | 26 | assignfile(txtQuelldatei, UTF8ToSys(conStrQuellDateiname)); | |
| 28 | 27 | assignfile(txtZieldatei, UTF8ToSys(conStrZielDateiname)); | |
| 29 | 28 | Rewrite(txtZieldatei); | |
| 30 | 29 | Reset(txtQuelldatei); | |
| 31 | 30 | Reset(txtZieldatei); | |
| 32 | 31 | ||
| 33 | 32 | while not EOF(txtQuelldatei) do | |
| 34 | 33 | begin | |
| 35 | 34 | ||
| 36 | 35 | Read(txtQuelldatei, chrZeichen); | |
| 37 | 36 | ||
| 38 | 37 | strPuffer := chrZeichen + #0; | |
| 39 | 38 | CharToOEM(PChar(strPuffer), @chrZeichen); | |
| 40 | 39 | ||
| 41 | 40 | Write(txtZieldatei, chrZeichen); | |
| 42 | 41 | ||
| 43 | 42 | end; | |
| 44 | 43 | ||
| 45 | 44 | closefile(txtQuelldatei); | |
| 46 | 45 | closefile(txtZieldatei); | |
| 47 | 46 | ||
| 48 | 47 | end; | |
| 49 | 48 | ``` | |
| 50 | 49 | ||
| 51 | - | ||
| 52 | 50 | Aufruf unter Windows: | |
| 53 | 51 | ||
| 54 | 52 | ``` pascal | |
| 55 | 53 | subAnsi2OEM('E:\Test_alt.txt', 'E:\Test_neu.txt'); | |
| 56 | 54 | ``` | |
| 57 | 55 | ||
| 58 | - | ||
| 59 | - | ||
| 60 | 56 | --Olaf 08:45, 24 March 2014 (CET) | |
| 61 | 57 | ||
| 62 | 58 | --- | |
| 63 | 59 | *From the Free Pascal wiki, page "Ansi2OEM/de", as it stood on 2020-02-09 after a change by GAN, 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).* | |
| 64 | 60 | Category: Code Snippets/de | |
| 65 | 61 | Category: Deutsch |
