Espacios de nombres
Variantes
Acciones

freopen

De cppreference.com
< c‎ | io

 
 
File input/output
Funciones
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Acceso a archivos
Original:
File access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
freopen
Directo de entrada / salida
Original:
Direct input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Entrada sin formato / salida
Original:
Unformatted input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Formato de entrada / salida
Original:
Formatted input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Presentar posicionamiento
Original:
File positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Gestión de errores
Original:
Error handling
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Las operaciones en los archivos
Original:
Operations on files
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
Definido en la cabecera <stdio.h>
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.

Contenido

[editar] 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
File access
mode string
Meaning Explanation Action if file
already exists
Action if file
does not exist
"r" read Open a file for reading read from start failure to open
"w" write Create a file for writing destroy contents create new
"a" append Append to a file write to end create new
"r+" read extended Open a file for read/write read from start error
"w+" write extended Create a file for read/write destroy contents create new
"a+" append extended Open a file for read/write write to end create new
File access mode flag "b" can optionally be specified to open a file in binary mode. This flag has effect only on Windows systems.
On the append file access modes, data is written to the end of the file regardless of the current position of the file position indicator.
Original:
null-terminated character string determining new file access mode
File access
mode string
Meaning Explanation Action if file
already exists
Action if file
does not exist
"r" read Open a file for reading read from start failure to open
"w" write Create a file for writing destroy contents create new
"a" append Append to a file write to end create new
"r+" read extended Open a file for read/write read from start error
"w+" write extended Create a file for read/write destroy contents create new
"a+" append extended Open a file for read/write write to end create new
File access mode flag "b" can optionally be specified to open a file in binary mode. This flag has effect only on Windows systems.
On the append file access modes, data is written to the end of the file regardless of the current position of the file position indicator.
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.

[editar] Valor de retorno

stream en caso de éxito, NULL en caso de fallo
Original:
stream on success, NULL on failure
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] 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.

#include <stdio.h>
 
int main()
{
    printf("stdout is printed to console");
    freopen("redir.txt", "w", stdout);
    printf("Stdout is redirected to a file");
    fclose(stdout);
}

Salida:

stdout is printed to console

[editar] 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) [editar]
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) [editar]
C++ documentation for freopen