摘要: 在C++工程中,自定义一个方法 void fgetsDemo(),在main 方法中调用,源代码如下:#include "stdafx.h"#include #include #include int _tmain(int argc, _TCHAR* argv[]){ /*Example for fgets*/ fgetsDemo(); return 0;}void fgetsDemo(){FILE *stream; char line[100]; if( fopen_s(&stream, "c:\crt_fgets.txt", "r& 阅读全文
posted @ 2014-02-13 17:33 細水長流 阅读(836) 评论(0) 推荐(0) 编辑
摘要: 1》 itoa, 将整数转换为字符串。char * itoa ( intvalue, char *buffer, intradix);它包含三个参数:value, 是要转换的数字;buffer, 是存放转换结果的字符串;radix, 是转换所用的基数,2-36。如,2:二进制,10:十进制,16:十六进制扩展:ltoa()将长整型值转换为字符串ultoa()将无符号长整型值转换为字符串Example:#include #include int _tmain(int argc, _TCHAR* argv[]){ int n; char buffer[33]; printf("E... 阅读全文
posted @ 2014-02-13 15:37 細水長流 阅读(19828) 评论(0) 推荐(0) 编辑
摘要: Converts an integer to a string.These are versions of_itoa, _i64toa, _ui64toa, _itow, _i64tow, _ui64towwith security enhancements as described inSecurity Features in the CRT.errno_t _itoa_s( int value, char *buffer, size_t sizeInCharacters, int radix );errno_t _i64toa_s( __int64 value, c... 阅读全文
posted @ 2014-02-13 14:19 細水長流 阅读(3116) 评论(0) 推荐(0) 编辑
摘要: Quote from: http://www.cplusplus.com/reference/cstdlib/itoa/functionRequired header :itoachar * itoa ( int value, char * str, int base );Convert integer to string (non-standard function)Converts an integervalueto a null-terminated string using the specifiedbaseand stores the result in the array giv. 阅读全文
posted @ 2014-02-13 13:36 細水長流 阅读(833) 评论(0) 推荐(0) 编辑