Hello all,
in the CVI help the documentation of the srtncpy you can read what's following
Output | ||
Name | Type | Description |
targetString | char [] | Contains the target string to which the specified number of characters from the source string are copied. If the source string is shorter than maxChars, ASCII NUL bytes are appended to the contents of this parameter until maxChars are written. If the source string is longer than maxChars, no ASCII NUL bytes are written to the contents of this parameter. If you want to guarantee that an ASCII NUL byte is at the end of the copied bytes, you can use the following: strncpy (target, source, n); target[n] = 0; |
I've put in bold + underline the relevant part.
I've a doubt about the code snippet provided as example
How could it be? I mean, it sounds like an off-by-one to me
May I have your kind opinion?
Tanks in advance
All the best