sprintf
语法:#include <stdio.h> int sprintf( char *buffer, const char *format, ... ); |
sprintf()函数和printf()类似, 只是把输出发送到buffer(缓冲区)中.返回值是写入的字符数量. 例如:
char string[50]; int file_number = 0; sprintf( string, "file.%d", file_number ); file_number++; output_file = fopen( string, "w" );