a bunch of bytes followed by a null character, which has the value 0. This has two obvious implications:
- There is no way to know where the string ends (that is, the string length) without moving through it, looking for the null character at the end.
- Your string can’t have any zeros in it. So you can’t store an arbitrary binary blob like a JPEG picture in a C string.
Why do C strings work this way? It’s because the PDP-7 microprocessor, on which UNIX and the C programming language were invented, had an ASCIZ string type. ASCIZ meant “ASCII with a Z (zero) at the end.”
да ё-моё, в моём случае не нужно знать длину, нужно пропарсить до конца и после парсить новую строку из того-же буфера
Обсуждают сегодня