strtof, strtod, strtold
Da cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
Definido no cabeçalho <stdlib.h>
|
||
float strtof( const char* str, char** str_end ); |
||
double strtod( const char* str, char** str_end ); |
||
long double strtold( const char* str, char** str_end ); |
||
Interpreta um valor de ponto flutuante em uma seqüência de bytes apontado por
str
.Original:
Interprets a floating point value in a byte string pointed to by
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.
Função descarta quaisquer caracteres em branco (como determinado pela std::isspace()) até que caráter não-primeiro espaço é encontrada. Em seguida, ele toma como caracteres possível para formar uma representação de ponto flutuante válido e os converte em valor de ponto flutuante. O valor de ponto flutuante válido pode ser um dos seguintes:
Original:
Function discards any whitespace characters (as determined by std::isspace()) until first non-whitespace character is found. Then it takes as many characters as possible to form a valid floating point representation and converts them to floating point value. The valid floating point value can be one of the following:
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.
- expressão ponto decimal flutuante. Consiste nas seguintes partes:Original:decimal floating point expression. It consists of the following parts:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- (opcional) mais ou de menosOriginal:(opcional) plus or minus signThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - seqüência não vazia de dígitos decimais, opcionalmente contendo um caractere de ponto decimal (define significand)Original:nonempty sequence of decimal digits optionally containing a decimal point character (defines significand)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - (opcional)
e
ouE
seguiu com menos opcionais ou sinal de mais e não vazio seqüência de dígitos decimais (define expoente)Original:(opcional)e
orE
followed with optional minus or plus sign and nonempty sequence of decimal digits (defines exponent)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
- binário expressão de ponto flutuante. Consiste nas seguintes partes:Original:binary floating point expression. It consists of the following parts:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- (opcional) mais ou de menosOriginal:(opcional) plus or minus signThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
0x
or0X
- seqüência não vazia de dígitos hexadecimais opcionalmente contendo um caractere de ponto decimal (define significand)Original:nonempty sequence of hexadecimal digits optionally containing a decimal point character (defines significand)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - (opcional)
p
ouP
seguiu com menos opcionais ou sinal de mais e não vazio seqüência de dígitos hexadecimais (define expoente)Original:(opcional)p
orP
followed with optional minus or plus sign and nonempty sequence of hexadecimal digits (defines exponent)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
- infinito expressão. Consiste nas seguintes partes:Original:infinity expression. It consists of the following parts:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- (opcional) mais ou de menosOriginal:(opcional) plus or minus signThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
INF
ouINFINITY
ignorando o casoOriginal:INF
orINFINITY
ignoring caseThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
- não-um número-expressão. Consiste nas seguintes partes:Original:not-a-number expression. It consists of the following parts:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- (opcional) mais ou de menosOriginal:(opcional) plus or minus signThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
NAN
ouNAN(
' char_sequence)
ignorando o caso da parteNAN
. Char_sequence' só pode conter caracteres alfanuméricos. O resultado é uma tranquila NaN valor de ponto flutuante.Original:NAN
orNAN(
char_sequence)
ignoring case of theNAN
part. char_sequence can only contain alphanumeric characters. The result is a quiet NaN floating point value.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
As funções define o ponteiro apontado pelo
str_end
para apontar para o caráter passado o último personagem interpretado. Se str_end
é NULL, ele é ignorado.Original:
The functions sets the pointer pointed to by
str_end
to point to the character past the last character interpreted. If str_end
is NULL, it is ignored.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.
Índice |
[editar] Parâmetros
str | - | ponteiro para o byte string terminada em nulo para ser interpretado
Original: pointer to the null-terminated byte string to be interpreted The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
str_end | - | ponteiro para um ponteiro para caracter .
Original: pointer to a pointer to character. 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
Flutuando valor do ponto correspondente ao conteúdo do
str
em caso de sucesso. Se o valor convertido cai fora do alcance do tipo de retorno correspondente, o erro ocorre e intervalo HUGE_VAL, HUGE_VALF ou HUGE_VALL é devolvido. Se nenhuma conversão pode ser executada, é devolvido 0.Original:
Floating point value corresponding to the contents of
str
on success. If the converted value falls out of range of corresponding return type, range error occurs and HUGE_VAL, HUGE_VALF or HUGE_VALL is returned. If no conversion can be performed, 0 is returned.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.
[editar] Exemplo
Esta seção está incompleta Motivo: sem exemplo |
[editar] Veja também
converte uma seqüência de byte para um valor de ponto flutuante Original: converts a byte string to a floating point value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
C++ documentation for strtof, strtod, strtold
|