std::freopen
De 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. |
<metanoindex/>
<tbody> </tbody>| Déclaré dans l'en-tête <cstdio>
|
||
FILE *freopen( const char *filename, const char *mode, FILE *stream ); |
||
Réaffecte un fichier existant
stream flux dans un fichier différent identifié par filenameusing mode spécifié. mode est utilisé pour déterminer le mode d'accès nouveau fichier . Original:
Reassigns an existing file stream
stream to a different file identified by filenameusing 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.
Paramètres
| filename | - | nom de fichier à associer le flux de fichier
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 | - | chaîne de caractères terminée par NULL déterminer le nouveau mode d'accès aux fichiers
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 | - | le flux de fichier à modifier
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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Retourne la valeur
stream en cas de succès, NULL cas d'échecOriginal:
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.
Exemple
Le code suivant redirige
stdout dans un fichier
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);
}
Résultat :
stdout is printed to console
Voir aussi
ouvre un fichier 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. (fonction) | |
ferme un fichier 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. (fonction) | |
C documentation for freopen
| |