33 lines
580 B
Markdown
33 lines
580 B
Markdown
|
# SetConsoleOutputCP – Funktion (Windows API)
|
|||
|
|
|||
|
Mit `SetConsoleOutputCP()` kann die Ausgabe-Codepage der Konsole geändert werden – z. B. für UTF-8.
|
|||
|
|
|||
|
## Definition
|
|||
|
|
|||
|
```c
|
|||
|
BOOL SetConsoleOutputCP(UINT wCodePageID);
|
|||
|
```
|
|||
|
|
|||
|
## Parameter
|
|||
|
|
|||
|
- `wCodePageID`: Ziel-Codepage, z. B. `65001` für UTF-8
|
|||
|
|
|||
|
## Beispiel
|
|||
|
|
|||
|
```c
|
|||
|
#include <windows.h>
|
|||
|
|
|||
|
int main() {
|
|||
|
SetConsoleOutputCP(65001); // Aktiviert UTF-8-Ausgabe
|
|||
|
printf("📁 Datei
|
|||
|
");
|
|||
|
return 0;
|
|||
|
}
|
|||
|
```
|
|||
|
|
|||
|
## Hinweise
|
|||
|
|
|||
|
- Nur unter Windows verfügbar
|
|||
|
- Gilt nur für das aktive Konsolenfenster
|
|||
|
- Muss vor Unicode-Ausgabe erfolgen
|