std::freopen
De cppreference.com
|
|
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
| Definido en el archivo de encabezado <cstdio>
|
||
FILE *freopen( const char *filename, const char *mode, FILE *stream ); |
||
Vuelve a asignar un
stream archivo continuo existente en un archivo diferente identificados por filenameusing modo especificado. mode se utiliza para determinar el acceso al archivo de nuevo . 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.
Parámetros
| filename | - | nombre de archivo para asociar la secuencia de archivo para
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 | - | terminada en nulo de serie de caracteres para determinar el nuevo modo de acceso a archivos
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 | - | la secuencia de archivo que desea modificar
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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Valor de retorno
stream en caso de éxito, NULL en caso de falloOriginal:
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.
Ejemplo
El código siguiente redirige
stdout en un archivo
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.
Ejecuta este código
#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);
}
Salida:
stdout is printed to console
Ver también
se abre un archivo 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. (función) | |
cierra un archivo 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. (función) | |
Documentación de C para freopen
| |