tsnprintf.c

来自「《unix网络编程第二卷》中的源代码」· C语言 代码 · 共 26 行

C
26
字号
/* * If your system does not provide snprintf(), this program will compile * but will have an undefined error from the linker. * * If you are using the lib/snprintf.c function that is supplied for * systems without snprintf(), you should get an error output from our * library function. * * If your system provides the function, and it works, there should be * no output. */#include	"unp.h"intmain(int argc, char **argv){	int		n;	char	buf[1024];	n = snprintf(buf, 4, "%d", 9999);	if (n > 3)		printf("error: snprintf overflowed buffer, n = %d\n", n);	exit(0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?