0

Let's say you wanted to read in a binary file that could potentially have NULLs in it. How would you do so in a language that was NULL terminated? I guess you'd just map it to a byte array?

1 Answer 1

1

If we talk about C (and the same or similar arguments apply to C++ as well), the zero-terminated strings in this language are rather a convention and I would not say that the "language is NULL terminated". Some functions - like strcpy or strlen treat null character in a string as the terminator. Other functions - like fread - do not. Use documentation to see if functions you want to use treat null character specially or not.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.