C strings by definition cannot incorporate NUL bytes, that is explicitly reserved as a terminating character. If you need a raw buffer that does support that then you can't use a C string. You will need to treat it differently. All of the C string functions starting with str
are off-limits here.
printf
with %s
will of course terminate on the NUL byte. If you want to print the whole buffer then you need to use lower-level tools like fwrite
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…