不熟悉的C字符串处理函数

    技术2022-06-27  110

     _itoa

    位于stdlib中。

    #include <stdlib.h> #include <stdio.h> void main( void ) { char buffer[20]; int i = 0x223; _itoa(i, buffer, 10); puts(buffer); _itoa(i, buffer, 16); printf("0x%s/n", buffer); getchar(); } // 547 // 0x223 

     

    scanf,  scanf_s

    fscanf, fscanf_s

    前者直接输入,后者需要指定长度

    http://topic.csdn.net/u/20110609/20/61e146fb-3d92-43ee-a017-00080e74cd04.html?seed=2003693757&r=73768052#r_73768052

    函数的格式控制:

    http://hi.baidu.com/vhou/blog/item/a6c4c4b07139e7530923022b.html

     

     

    long int strtol ( const char * str, char ** endptr, int base );

    Convert string to long integer

     

    string.h/cstring Functions

    Copying: memcpyCopy block of memory (function) memmoveMove block of memory (function) strcpyCopy string (function) strncpyCopy characters from string (function) Concatenation: strcatConcatenate strings (function) strncatAppend characters from string (function) Comparison: memcmpCompare two blocks of memory (function) strcmpCompare two strings (function) strcollCompare two strings using locale (function) strncmpCompare characters of two strings (function) strxfrmTransform string using locale (function) Searching: memchrLocate character in block of memory (function) strchrLocate first occurrence of character in string (function) strcspnGet span until character in string (function) strpbrkLocate character in string (function) strrchrLocate last occurrence of character in string (function) strspnGet span of character set in string (function) strstrLocate substring (function) strtokSplit string into tokens (function) Other: memsetFill block of memory (function) strerrorGet pointer to error message string (function) strlenGet string length (function)


    最新回复(0)