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

strtok function returns NULL value

$
0
0
I am using Labwindows CVI to use a experimental equipment. And I made a code but there is a error.

treadbuff value is 0x06818A30 "" However, strtok function returns NULL value so error happens in the last row.

I don't know what is wrong here.

 

#define MAX_COMM_LEN 128   
char *tbuff; 
char *treadbuff;  
double tcurrent;     

treadbuff = (char*)malloc(MAX_COMM_LEN*sizeof(char)); 

memset(treadbuff, 0x0, MAX_COMM_LEN);  

tbuff = (char*)malloc(MAX_COMM_LEN*sizeof(char));               
memset(tbuff, 0x0, MAX_COMM_LEN);

tbuff = strtok (treadbuff, "A,");
tcurrent = atof(tbuff);

Viewing all articles
Browse latest Browse all 5351

Trending Articles



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