Hi,
I am trying to study the SafeString functions, and use them. .... Using #include <strsafe.h>, and strsafe.lib.
Here and there I read the functions deprecated are not guaranteed to be null terminated. I have read you must verify it.
I have tried to understand pointers, and arrays etc. My background is scripting. C++ info is everywhere, but there is not
the concern for buffer over-run possibilities.
So I am trying to understand things from the bottom up (and I do mean bottom!) So I must ask what will no doubt seem like a dumb question.
The null terminator is always refered to as '\0'.
Code clip (used in console program), char strsrc[20]="this is a test";
strsrc[sizeof(strsrc)-1] = '\0'; /* ensure null terminated */
With defaults, after "test", I have '0', '0', '0', etc until the 20th array cell is filled.
One question is (concerned with copying and concantenation operations): Do I have to worry about having more than one Null terminator?
I have looked in various books, and looked on the net. I am unsure.
The Null terminator is represented as '\0', and it is the final '0': Is that '0' any different than a previous '0' in the array?
I have also read that quoted strings are by definition null terminated, but I have never read .....if it is guaranteed.
Only C has the high level of concern for buffer overrun (by function operations that do not guarantee it), so I am trying to really understand how I can write Safe string operations.
Thanks in advance, ...........any book or link suggestions to help my brain would also be appreciated.
... Ed