LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Missing terminating null in string argument

I used CopyBytes to create a string.  When I use this string with strcpy() or strcmp(), I receive a fatal run-time error:  "Missing terminating null in string argument."  I made sure I left room for the null terminator, but it doesn't seem to make any difference.  I read an old post regarding the same issue and supposedly this error was fixed in version 3.1 but this error still occurs in version 6.0.  Any suggestions?
0 Kudos
Message 1 of 2
(5,602 Views)

You may have left room for the NUL terminator but did you actually copy it to the destination string? Try adding 1 to the number of bytes that you copy with the CopyBytes() function. eg:

CopyBytes (target, 0, source, 0, strlen (source) + 1);

Alternatively use CopyString() which automatically adds the NUL for you.

JR

0 Kudos
Message 2 of 2
(5,586 Views)