LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

I didn't understand the SCAN function

Hi.

This function should be so easy but still I can't get the result:

unsigned char readBuf[20]={0};
char String[20]={0};

Scan (String, "%s>%16x[b1w2]", readBuf);
String=d21c9000d21c9000;

Why the result is this:
readBuf[0]=d2,readBuf[1]=1c,readBuf[2]=90,readBuf[3]=00,readBuf[4]=00,readBuf[5]=00,readBuf[6]=00,readBuf[7]=00

I expected this result:
readBuf[0]=d2,readBuf[1]=1c,readBuf[2]=90,readBuf[3]=00,readBuf[4]=d2,readBuf[5]=1c,readBuf[6]=90,readBuf[7]=00

Thanks.
0 Kudos
Message 1 of 2
(2,900 Views)
If you are looking at readBuf with the String display (with F7 key) you can use the "Display entire buffer" option to disply the complete string after the first 00. The display string assumes you are displaying a string, that is usually terminated on \0 character.

Another way of displaying the entire string is to look at it in the Variables window clicking on the triangle on the left of the variable name: the entire array is exploded and you can check individual elements of it even after the "terminator" caracter.

Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 2
(2,900 Views)