Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5355

Attempt to write beyond end of string

$
0
0

I'm in need of some knowledge-based information I'm trying to recall from my programming days how many characters can a pointer hold? Below is where I'm getting an error with an attempt to write beyond end of string on the pointer variable product.

 

Any suggests would be great thanks!

 

int GetProductName (char devName[DAQ_DEVICE_NAME_LEN+1], char *product)
{
int error = 0;
char cInfo[4100] = {"\0"};

memset( cInfo, '\0', 4100 * sizeof(char));
if ((error = DAQmxGetDeviceAttribute (devName, DAQmx_Dev_ProductType, cInfo, 4100)) != 0) goto Error;
if (strlen(cInfo) > DAQ_PRODUCT_NAME_LEN) cInfo[DAQ_NAME_LEN-1] = '\0';
Fmt(product, "%s<%s", cInfo);

return error;
Error:
ShowDAQmxError(0, error, "GetProductNames", 0);
return error;
}


Viewing all articles
Browse latest Browse all 5355

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>