Namespace
Varianti

std::strtok

Da cppreference.com.
< cpp‎ | string‎ | byte

 
 
Stringhe libreria
Null-stringhe terminate
Original:
Null-terminated strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Byte stringhe
Multibyte stringhe
Stringhe larghe
Classi
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string
char_traits
 
Null-stringhe terminate byte
Funzioni
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Carattere manipolazione
Original:
Character manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Le conversioni in formati numerici
Original:
Conversions to numeric formats
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Della gestione delle stringhe
Original:
String manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
strcpy
strncpy
strcat
strncat
strxfrm
String esame
Original:
String examination
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Memoria manipolazione
Original:
Memory manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
memchr
memcmp
memset
memcpy
memmove
Varie
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
strerror
 
Defined in header <cstring>
char* strtok( char* str, const char* delim );
Trova il prossimo token in una stringa con terminazione null byte puntato da str. I caratteri separatori sono identificati da stringa con terminazione null byte puntato da delim.
Original:
Finds the next token in a null-terminated byte string pointed to by str. The separator characters are identified by null-terminated byte string pointed to by delim.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Se str != NULL, la funzione di ricerca per il primo carattere che non separatore. Questo personaggio è l'inizio del token. Allora la funzione ricerca per il carattere primo separatore. Questo personaggio è la fine della token. Funzione termina e restituisce NULL se fine str si incontra prima della fine della token viene trovato. In caso contrario, un puntatore alla fine della token viene salvato in una posizione statica per chiamate successive. Questo carattere viene successivamente sostituito da un NULL caratteri e la funzione restituisce un puntatore all'inizio del gettone.
Original:
If str != NULL, the function searches for the first character which is not separator. This character is the beginning of the token. Then the function searches for the first separator character. This character is the end of the token. Function terminates and returns NULL if end of str is encountered before end of the token is found. Otherwise, a pointer to end of the token is saved in a static location for subsequent invocations. This character is then replaced by a NULL-character and the function returns a pointer to the beginning of the token.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Se str == NULL, la funzione continua da dove si era nella chiamata precedente. Il comportamento è lo stesso se il puntatore precedentemente memorizzato viene passato come str.
Original:
If str == NULL, the function continues from where it left in previous invocation. The behavior is the same as if the previously stored pointer is passed as str.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Indice

[modifica] Parametri

str -
puntatore alla stringa con terminazione null byte da tokenize
Original:
pointer to the null-terminated byte string to tokenize
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
delim -
puntatore alla stringa con terminazione null byte che identifica delimitatori
Original:
pointer to the null-terminated byte string identifying delimiters
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

Puntatore all'inizio di un token se la fine della stringa non è stato rilevato. In caso contrario, restituisce NULL.
Original:
Pointer to the beginning of a token if the end of string has not been encountered. Otherwise returns NULL.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Nota

La funzione non è thread-safe.
Original:
The function is not thread safe.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Esempio

#include <cstring>
#include <iostream>
 
int main() 
{
    char input[100] = "A bird came down the walk";
    char *token = std::strtok(input, " ");
    while (token != NULL) {
        std::cout << token << '\n';
        token = std::strtok(NULL, " ");
    }
}

Output:

A
bird
came
down
the
walk

[modifica] Vedi anche

C documentation for strtok