String output, sometimes incorrect
In this sample line of code below, the output varies greatly. I would think by the syntax that the number of returned characters should only be 6. But every once in a while the number returned is actually from the starting point in the string (szBarcode) to the end, which is actually 18 characters. How come this line is not functioning properly? What would the next line be if I wanted to take only the first six characters from szfWgt and make that szfWgt?
strncpy(((char*)wh.szfWgt), (szBarcode + 28),6);
Thanks in advance for any help.