std::freopen
Aus cppreference.com
![]() | This page has been machine-translated from the English version of the wiki using Google Translate. The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
definiert in Header <cstdio> | ||
FILE *freopen(constchar*filename, constchar*mode, FILE *stream ); | ||
Weist eine vorhandene Datei Stream
stream
auf eine andere Datei filename
using angegebenen Modus identifiziert. mode
wird verwendet, um die neue Datei Zugriff Modus zu bestimmen . Original:
Reassigns an existing file stream
stream
to a different file identified by filename
using specified mode. mode
is used to determine the new file access mode. The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Inhaltsverzeichnis |
[Bearbeiten]Parameter
filename | - | Dateinamen, um die Datei-Stream zu assoziieren Original: file name to associate the file stream to The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mode | - | null-terminierte Zeichenkette Festlegung neuer File Access Modus
Original: null-terminated character string determining new file access mode
The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
stream | - | der Datei-Stream zu ändern Original: the file stream to modify The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[Bearbeiten]Rückgabewert
stream
bei Erfolg NULL im FehlerfallOriginal:
stream
on success, NULL on failureThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten]Beispiel
Der folgende Code leitet
stdout
in einer Datei Original:
The following code redirects
stdout
to a file The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
#include <cstdio> int main(){std::printf("stdout is printed to console"); std::freopen("redir.txt", "w", stdout);std::printf("stdout is redirected to a file")std::fclose(stdout);}
Output:
stdout is printed to console
[Bearbeiten]Siehe auch
öffnet eine Datei Original: opens a file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktion) | |
schließt eine Datei Original: closes a file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktion) | |
C documentation for freopen |