std::basic_filebuf::open
Da cppreference.com.
< cpp | io | basic filebuf
![]() | Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
std::basic_filebuf<CharT, Traits>* open(constchar* s, std::ios_base::openmode mode ) | (1) | |
std::basic_filebuf<CharT, Traits>* open(conststd::string& s, std::ios_base::openmode mode ) | (2) | (dal C++11) |
Apre il file il cui nome è dato da
1) Original:
Opens the file whose name is given by
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.
il null-terminated stretta byte
2) s
stringaOriginal:
the null-terminated narrow byte string
s
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.
il null-terminated stretta byte s.c_str() stringa
Original:
the null-terminated narrow byte string s.c_str()
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.
come se chiamando std::fopen(s, modestring), dove viene determinato
modestring
come segue:Original:
as if by calling std::fopen(s, modestring), where
modestring
is determined as follows: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.
modestring Original: modestring The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | openmode & ~ate |
"r" | in |
"w" | out , out|trunc |
"a" | app , out|app |
"r+" | out|in |
"w+" | out|in|trunc |
"a+" | out|in|app, in|app |
"rb" | binary|in |
"wb" | binary|out, binary|out|trunc |
"ab" | binary|app, binary|out|app |
"r+b" | binary|out|in |
"w+b" | binary|out|in|trunc |
"a+b" | binary|out|in|app, binary|in|app |
Se
openmode
non è una delle modalità elencate, la open()
fallisce.Original:
If
openmode
is not one of the modes listed, the open()
fails.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.
Se l'operazione ha esito positivo e aperto openmode &std::ios_base::ate!=0 (il bit
ate
è impostato), riposiziona la posizione del file alla fine del file, come se chiamando std::fseek(file, 0, SEEK_END). Se il riposizionamento non riesce, chiama close()
e restituisce un puntatore nullo per indicare l'errore.Original:
If the open operation succeeds and openmode &std::ios_base::ate!=0 (the
ate
bit is set), repositions the file position to the end of file, as if by calling std::fseek(file, 0, SEEK_END). If the repositioning fails, calls close()
and returns a null pointer to indicate failure.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.
Se il file associato è stato già aperto, restituisce un puntatore nullo subito.
Original:
If the associated file was already open, returns a null pointer right away.
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.
Indice |
[modifica]Parametri
s | - | il nome del file da aprire Original: the file name to open The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
openmode | - | la modalità di apertura del file, un file binario o delle modalità std::ios_base Original: the file opening mode, a binary OR of the std::ios_base modes The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[modifica]Valore di ritorno
*this in caso di successo, un puntatore nullo in caso di errore.
Original:
*this on success, a null pointer on failure.
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.
[modifica]Note
open()
viene in genere chiamato tramite il costruttore o la funzione di membro del open()
std::basic_fstream.Original:
open()
is typically called through the constructor or the open()
member function of std::basic_fstream.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.
[modifica]Esempio
This section is incomplete Reason: no example |
[modifica]Vedi anche
checks if the associated file is open (metodo pubblico) | |
svuota il buffer dell'area mettere e chiude il file associato Original: flushes the put area buffer and closes the associated file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) |