Espacios de nombres
Variantes
Acciones

std::basic_filebuf::seekoff

De cppreference.com
< cpp‎ | io‎ | basic filebuf
 
 
Biblioteca de E/S
Manipuladores de E/S
E/S estilo C
Búferes
(en desuso en C++98)
Flujos
Abstracciones
E/S de archivos
E/S de cadenas
E/S de arrays
(en desuso en C++98)
(en desuso en C++98)
(en desuso en C++98)
Salida sincronizada
Tipos
Interfaz de categoría de error
(C++11)
 
std::basic_filebuf
Las funciones públicas miembros
Original:
Public member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Protegido funciones miembro
Original:
Protected member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_filebuf::seekoff
Terceros funciones
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
protected:

virtual pos_type seekoff( off_type off,
                          std::ios_base::seekdir way,

                          std::ios_base::openmode which = std::ios_base::in | std::ios_base::out );
Cambia de posición el puntero de archivo, si es posible, en la posición que corresponde exactamente a off caracteres desde el principio, al final oa la posición actual del archivo (en función del valor de way .
Original:
Repositions the file pointer, if possible, to the position that corresponds to exactly off characters from beginning, end, or current position of the file (depending on the value of way.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Si el archivo asociado no está abierta (is_open()==false, no inmediatamente
Original:
If the associated file is not open (is_open()==false, fails immediately.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
. Si la codificación de caracteres multibyte es dependiente del estado (codecvt::encoding() volvió -1) o de longitud variable-(codecvt::encoding() volvió 0) y la off desplazamiento no es 0, falla inmediatamente:. esta función no puede determinar el número de bytes que corresponden a off personajes .
Original:
If the multibyte character encoding is state-dependent (codecvt::encoding() returned -1) or variable-length (codecvt::encoding() returned 0) and the offset off is not 0, fails immediately: this function cannot determine the number of bytes that correspond to off characters.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
way Si no es std::basic_ios::cur o off el desplazamiento no es 0, y la más molesta operación que se hace en este objeto filebuf era la producción (es decir, o poner el buffer no está vacío, o era la función más recientemente llamada overflow()), a continuación, llama std::codecvt::unshift para determinar la secuencia necesaria unshift, y escribe esa secuencia para el archivo llamando overflow() .
Original:
If way is not std::basic_ios::cur or the offset off is not 0, and the most resent operation done on this filebuf object was output (that is, either the put buffer is not empty, or the most recently called function was overflow()), then calls std::codecvt::unshift to determine the unshift sequence necessary, and writes that sequence to the file by calling overflow().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
convierte entonces la way argumento a un valor de whence int tipo como sigue:..
Original:
Then converts the argument way to a value whence of type int as follows:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
valor de way
Original:
value of way
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
value of whence
std::basic_ios::beg SEEK_SET
std::basic_ios::end SEEK_END
std::basic_ios::cur SEEK_CUR
Entonces, si el carácter codificación es de ancho fijo (codecvt::encoding() devuelve un número positivo width, mueve el puntero de archivo, como por std::fseek(file, width*off, whence) .
Original:
Then, if the character encoding is fixed-width (codecvt::encoding() returns some positive number width, moves the file pointer as if by std::fseek(file, width*off, whence).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
De lo contrario, se mueve el puntero de archivo, como por std::fseek(file, 0, whence) .
Original:
Otherwise, moves the file pointer as if by std::fseek(file, 0, whence).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
openmode El argumento, requerido por la firma de base función de la clase , tiende a ser ignorado, porque std::basic_filebuf solo mantiene una posición archivo .
Original:
The openmode argument, required by the base class function signature, is usually ignored, because std::basic_filebuf maintains only one file position.
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

off -
posición relativa para establecer el indicador de posición al .
Original:
relative position to set the position indicator to.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
dir -
define la posición de la base para aplicar el ajuste relativo a. Puede ser uno de las siguientes constantes:
Constante Explicación
beg El comienzo de un flujo.
end El final de un flujo
cur La posición actual del indicador de posición del flujo
Original:
defines base position to apply the relative offset to. It can be one of the following constants:
Constante Explicación
beg El comienzo de un flujo.
end El final de un flujo
cur La posición actual del indicador de posición del flujo
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
which -
que define de la entrada y / o secuencias de salida a afectar. Puede ser uno o una combinación de las siguientes constantes:
Constant
Original:
Constant
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Explanation
in
afectar a la secuencia de entrada
Original:
affect the input sequence
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
out
afectar a la secuencia de salida
Original:
affect the output sequence
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Original:
defines which of the input and/or output sequences to affect. It can be one or a combination of the following constants:
Constant
Original:
Constant
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Explanation
in
afectar a la secuencia de entrada
Original:
affect the input sequence
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
out
afectar a la secuencia de salida
Original:
affect the output sequence
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
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

Objeto de nueva construcción de pos_type tipo que almacena la posición del archivo resultante, o en caso de fallo pos_type(off_type(-1)) .
Original:
A newly constructed object of type pos_type which stores the resulting file position, or pos_type(off_type(-1)) 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] Notas

seekoff() es llamado por std::basic_streambuf::pubseekoff, la cual es invocado std::basic_istream::seekg, std::basic_ostream::seekp, std::basic_istream::tellg, y std::basic_ostream::tellp
Original:
seekoff() is called by std::basic_streambuf::pubseekoff, which is called by std::basic_istream::seekg, std::basic_ostream::seekp, std::basic_istream::tellg, and std::basic_ostream::tellp
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Ejemplo

#include <iostream>
#include <fstream>
#include <locale>
int main()
{
    // prepare a 10-byte file holding 4 characters in UTF8
    std::ofstream("text.txt") << u8"z\u00df\u6c34\U0001d10b"; // or u8"zß水𝄋"
                                           // or "\x7a\xc3\x9f\xe6\xb0\xb4\xf0\x9d\x84\x8b";
 
    // open using a non-converting encoding
    std::ifstream f1("text.txt");
    std::cout << "f1's locale's encoding() returns "
              << std::use_facet<std::codecvt<char, char, std::mbstate_t>>(f1.getloc()).encoding() << '\n'
              << "pubseekoff(3, beg) returns " << f1.rdbuf()->pubseekoff(3, std::ios_base::beg) << '\n'
              << "pubseekoff(0, end) returns " << f1.rdbuf()->pubseekoff(0, std::ios_base::end) << '\n';;
 
    // open using UTF-8
    std::wifstream f2("text.txt");
    f2.imbue(std::locale("en_US.UTF-8"));
    std::cout << "f2's locale's encoding() returns "
              << std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>>(f2.getloc()).encoding() << '\n'
              << "pubseekoff(3, beg) returns " << f2.rdbuf()->pubseekoff(3, std::ios_base::beg) << '\n'
              << "pubseekoff(0, end) returns " << f2.rdbuf()->pubseekoff(0, std::ios_base::end) << '\n';
 
}

Salida:

f1's locale's encoding() returns 1
pubseekoff(3, beg) returns 3
pubseekoff(0, end) returns 10
f2's locale's encoding() returns 0
pubseekoff(3, beg) returns -1
pubseekoff(0, end) returns 10

[editar] Ver también

Invoca a seekoff().
(función miembro pública de std::basic_streambuf<CharT,Traits>) [editar]
[virtual]
reposiciona la posición del archivo, usando direccionamiento absoluto
Original:
repositions the file position, using absolute addressing
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro virtual protegida) [editar]
desplaza el indicador de posición de archivo a una ubicación específica en un archivo
Original:
moves the file position indicator to a specific location in 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]