sprintf: http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/
Portotype: int printf(char* str, const char* format, parameters);
Writes into the array pointed by str a C string consisting on a sequence of data formatted as the format argument specifies. After the format parameter, the function expects at least as many additional arguments as specified in format.
This function behaves exactly as printf does, but writing its result to a string instead of stdout. The size of the array passed as str should be enough to contain the entire formatted string .
Return value:
On success, the total number of characters written is returned. This count does not include the additional null-character automatically appended at the end of the string.






//same as int flag1 = sprintf(str,"%s is written to str.","Test","tEST");



On failure, a negative number is returned.









// 在dev c++不能运行,vc6.0沒有问题






没有测试出什么时候出错返回负值呢!!谁给我一个例子?