Rechercher une page de manuel
strtod
Langue: ja
Version: 2001-06-07 (openSuse - 09/10/07)
Section: 3 (Bibliothèques de fonctions)
̾Á°
strtod, strtof, strtold - ASCII ʸ»úÎó¤òÉâÆ°¾®¿ôÅÀ¼Â¿ô¤ËÊÑ´¹¤¹¤ë½ñ¼°
#include <stdlib.h>double strtod(const char *nptr, char **endptr);
#define _XOPEN_SOURCE 600 /* or #define _ISOC99_SOURCE */
#include <stdlib.h>
float strtof(const char *nptr, char **endptr);
long double strtold(const char *nptr, char **endptr);
ÀâÌÀ
strtod(), strtof(), strtold() ´Ø¿ô¤Ï¡¢ nptr ¤¬»Ø¤·¼¨¤¹Ê¸»úÎó¤Î¤Ï¤¸¤á¤ÎÉôʬ¤ò double, float, long double ·¿¤ÎÃͤˤ½¤ì¤¾¤ìÊÑ´¹¤¹¤ë¡£ÆþÎϤ¹¤ëʸ»úÎó (¤ÎÀèƬÉôʬ) ¤Ï°Ê²¼¤Î·Á¼°¤¬´üÂÔ¤µ¤ì¤Æ¤¤¤ë¡£ ÀèƬ¤Ë¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹¡¢ ¼¡¤Ë¥×¥é¥¹ ("+") ¤Þ¤¿¤Ï¥Þ¥¤¥Ê¥¹ ("-") ¤Îµ¹æ¡¢ ¤½¤Î¸å¤Ë (i) 10 ¿Ê¿ô¡¢(ii) 16 ¿Ê¿ô¡¢(iii) ̵¸Â¡¢ (iv) NAN (·×»»¤Ç¤¤Ê¤¤¿ô¡¢not-a-number) ¤Î¤¤¤º¤ì¤«¤¬¤¢¤ë (¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹¡¢Éä¹æ¤Ï¾Êά²Äǽ¡£ ¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹¤Ï isspace(3) ¤Ç¼±Ê̤µ¤ì¤ë)¡£
10 ¿Ê¿ô ¤Ï 1 ʸ»ú°Ê¾å¤Î 10 ¿Ê¤Î¿ô»ú¤ÎÎ󤫤é¤Ê¤ê¡¢ ´ð¤òɽ¤¹Ê¸»ú (radix charater) (¾®¿ôÅÀ¡£¥í¥±¡¼¥ë¤Ë°Í¸¤¹¤ë¤¬¡¢Ä̾ï¤Ï ".") ¤¬´Þ¤Þ¤ì¤ë¤³¤È¤â¤¢¤ë¡£ ¤³¤Î¸å¤Ë 10 ¿Ê¤Î»Ø¿ôÉô¤¬Â³¤¤¤Æ¤âÎɤ¤¡£ 10 ¿Ê¤Î»Ø¿ôÉô¤Ï "E" ¤Þ¤¿¤Ï "e" ¤È¡¢¤½¤Î¸å¤ËÃÖ¤«¤ì¤ëÀµÉéµ¹æ (¾Êά²Ä)¡¢ ¤ª¤è¤Ó¤½¤Î¸å¤Ë³¤¯ 1 ʸ»ú°Ê¾å¤Î 10 ¿Ê¤Î¿ô»ú¤ÎÎ󤫤é¤Ê¤ê¡¢ 10 ¤Î²¿¾è¤Ç¤¢¤ë¤«¤òɽ¤¹¡£
16 ¿Ê¿ô ¤Ï¡¢"0x" ¤Þ¤¿¤Ï "0X" ¤È¤½¤Î¸å¤Ë³¤¯ 1 ʸ»ú°Ê¾å¤Î 16 ¿Ê¤Î¿ô»ú¤ÎÎ󤫤é¤Ê¤ê¡¢ ´ð¤òɽ¤¹Ê¸»ú¤¬´Þ¤Þ¤ì¤ë¤³¤È¤â¤¢¤ë¡£ ¤³¤Î¸å¤Ë 2 ¿Ê¤Î»Ø¿ôÉô¤¬Â³¤¤¤Æ¤âÎɤ¤¡£ 2 ¿Ê¤Î»Ø¿ôÉô¤Ï "P" ¤Þ¤¿¤Ï "p" ¤È¡¢¤½¤Î¸å¤ËÃÖ¤«¤ì¤ëÀµÉéµ¹æ (¾Êά²Ä)¡¢ ¤ª¤è¤Ó¤½¤Î¸å¤Ë³¤¯ 1 ʸ»ú°Ê¾å¤Î 10 ¿Ê¤Î¿ô»ú¤ÎÎ󤫤鹽À®¤µ¤ì¡¢ 2 ¤Î²¿¾è¤Ç¤¢¤ë¤«¤òɽ¤¹¡£ ´ð¤òɽ¤¹Ê¸»ú¤È 2 ¿Ê¤Î»Ø¿ôÉô¤Ï¡¢¤É¤Á¤é¤«°ìÊý¤·¤«Â¸ºß¤·¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
̵¸Â ¤Ï "INF" ¤Þ¤¿¤Ï "INFINITY" ¤Çɽ¤µ¤ì¡¢Âçʸ»ú¾®Ê¸»ú¤Ï¶èÊ̤µ¤ì¤Ê¤¤¡£
NAN ¤Ï "NAN" (Âçʸ»ú¾®Ê¸»ú¤Ï¶èÊ̤µ¤ì¤Ê¤¤) ¤Çɽ¤µ¤ì¡¢ ¤½¤Î¸å¤Ë `(' ʸ»úÎó ')' ¤¬Â³¤¯¾ì¹ç¤â¤¢¤ë¡£ ¤³¤Îʸ»úÎó¤Ï¼ÂÁõ¤Ë°Í¸¤¹¤ë NAN ¤ò»ØÄꤹ¤ë¡£
ÊÖ¤êÃÍ
¤³¤ì¤é¤Î´Ø¿ô¤Ï¡¢ÊÑ´¹¤µ¤ì¤¿Ãͤ¬¤¢¤ì¤Ð¡¢¤½¤ì¤òÊÖ¤¹¡£endptr ¤¬ NULL ¤Ç¤Ê¤¤¤È¤¤Ï¡¢ÊÑ´¹¤Ë»È¤ï¤ì¤¿ºÇ½ªÊ¸»ú¤Î¼¡¤Îʸ»ú¤Ø¤Î¥Ý¥¤¥ó¥¿¡¼¤¬ endptr ¤Ç»²¾È¤µ¤ì¤ë¾ì½ê¤ØÊݸ¤µ¤ì¤ë¡£
ÊÑ´¹¤¬¹Ô¤ï¤ì¤Ê¤«¤Ã¤¿¤È¤¤Ë¤Ï 0 ¤¬Ê֤롣¤½¤·¤Æ endptr ¤¬»²¾È¤·¤Æ¤¤¤ë¾ì½ê¤Ë nptr ¤ÎÃÍ (ÊÑ´¹ÂоݤǤ¢¤ëʸ»úÎó¤Î³«»Ï¥¢¥É¥ì¥¹) ¤¬Êݸ¤µ¤ì¤ë¡£
Àµ¤·¤¤·Á¼°¤Î¿ôÃÍʸ»úÎó¤Ç¤¢¤ë¤¬¡¢ÊÑ´¹·ë²Ì¤¬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤òµ¯¤³¤·¤¿¾ì¹ç ¤Ë¤Ï¡¢¥×¥é¥¹¤Þ¤¿¤Ï¥Þ¥¤¥Ê¥¹¤Î HUGE_VAL (HUGE_VALF, HUGE_VALL) ¤¬ÊÖ¤ê (ÃͤÎÉä¹æ¤Ë¤è¤ë)¡¢ ERANGE ¤¬ errno ¤ËÂåÆþ¤µ¤ì¤ë¡£ÊÑ´¹·ë²Ì¤¬¥¢¥ó¥À¡¼¥Õ¥í¡¼¤òµ¯¤³¤·¤¿¾ì¹ç¤Ë¤Ï 0 ¤¬Ê֤ꡢ ERANGE ¤¬ errno ¤ËÂåÆþ¤µ¤ì¤ë¡£
¥¨¥é¡¼
- ERANGE
- ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤Þ¤¿¤Ï¥¢¥ó¥À¡¼¥Õ¥í¡¼¤¬µ¯¤³¤Ã¤¿¡£
½àµò
C89 ¤Ç¤Ï strtod() ¤¬¡¢C99 ¤Ç¤Ï»Ä¤ê¤Î 2 ¤Ä¤Î´Ø¿ô¤¬µ½Ò¤µ¤ì¤Æ¤¤¤ë¡£Ãí°Õ
À®¸ù¡¢¼ºÇԤɤÁ¤é¤Î¾ì¹ç¤Ç¤â 0 ¤òÊÖ¤¹²ÄǽÀ¤¬¤¢¤ë¤Î¤Ç¡¢ ¥×¥í¥°¥é¥à¤Ï¸Æ¤Ó½Ð¤¹Á°¤Ë errno ¤ò 0 ¤ËÀßÄꤷ¡¢¸Æ¤Ó½Ð¤·¸å¤Ë errno ¤¬ 0 °Ê³°¤ÎÃͤ«¤É¤¦¤«¤ò³Îǧ¤·¥¨¥é¡¼¤¬È¯À¸¤·¤¿¤«¤É¤¦¤«¤òȽÃǤ¹¤ë ɬÍפ¬¤¢¤ë¡£Îã
strtol(3) ¤Î¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤ÎÎã¤ò»²¾È¡£ ¤³¤Î¥Ú¡¼¥¸¤ÇÀâÌÀ¤·¤¿´Ø¿ô¤Î»ÈÍÑÊýË¡¤âƱÍͤǤ¢¤ë¡£´ØÏ¢¹àÌÜ
atof(3), atoi(3), atol(3), strtol(3), strtoul(3), feature_test_macros(7)Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre