read
ssize_t read(int fildes, void *buf, size_t nbyte);
不一定读满nbyte
,读到换行符n
就停止(n
会被读入)。
rop到read的时候可以忽略第三个参数。
gets
char * gets(char *str);
读到换行符n
为止,可以读入x00
。
scanf
int scanf(const char *format, ...);
读到换行符n
为止,可以读入x00
,注意格式参数。
scanf("%256s",buffer)
会在最后加'x00'
,有可能造成one-byte-off
近期评论