Data string Parsing
-
Hello, Actually, am getting data from the machine as 0x03 0x10 0x82 0x10..... and length of the buffer is varying, as Length:108 or 256 or....so how to proceed further to parse the data and store the data in an array. do we have any Active X control for parsing the data?
-
Hello, Actually, am getting data from the machine as 0x03 0x10 0x82 0x10..... and length of the buffer is varying, as Length:108 or 256 or....so how to proceed further to parse the data and store the data in an array. do we have any Active X control for parsing the data?
srija wrote:
do we have any Active X control for parsing the data?
how an activeX could help you there ??? well, you reposted your question, but you don't really say much once again.
srija wrote:
am getting data from the machine as 0x03 0x10 0x82 0x10
this doesn't mean anything (or it could mean everything) depending on haw you want to interpret those bytes... that's why i asked you the format of the datas supposed to be received... please precise the type on how you receive those data, how you want to change them, tell also if there are some important thing to read from the stream... help us or we won't be able to help you !!
TOXCCT >>> GEII power
[toxcct][VisualCalc 2.24][3.0 soon...] -
Hello, Actually, am getting data from the machine as 0x03 0x10 0x82 0x10..... and length of the buffer is varying, as Length:108 or 256 or....so how to proceed further to parse the data and store the data in an array. do we have any Active X control for parsing the data?
-
srija wrote:
do we have any Active X control for parsing the data?
how an activeX could help you there ??? well, you reposted your question, but you don't really say much once again.
srija wrote:
am getting data from the machine as 0x03 0x10 0x82 0x10
this doesn't mean anything (or it could mean everything) depending on haw you want to interpret those bytes... that's why i asked you the format of the datas supposed to be received... please precise the type on how you receive those data, how you want to change them, tell also if there are some important thing to read from the stream... help us or we won't be able to help you !!
TOXCCT >>> GEII power
[toxcct][VisualCalc 2.24][3.0 soon...] -
srija wrote:
do we have any Active X control for parsing the data?
how an activeX could help you there ??? well, you reposted your question, but you don't really say much once again.
srija wrote:
am getting data from the machine as 0x03 0x10 0x82 0x10
this doesn't mean anything (or it could mean everything) depending on haw you want to interpret those bytes... that's why i asked you the format of the datas supposed to be received... please precise the type on how you receive those data, how you want to change them, tell also if there are some important thing to read from the stream... help us or we won't be able to help you !!
TOXCCT >>> GEII power
[toxcct][VisualCalc 2.24][3.0 soon...] -
Hello, Actually, am getting data from the machine as 0x03 0x10 0x82 0x10..... and length of the buffer is varying, as Length:108 or 256 or....so how to proceed further to parse the data and store the data in an array. do we have any Active X control for parsing the data?
I hope to understand you right. The aim is to convert a variable length block of input data with hexadecimal numbers into an array to integers. If it' true try this:
// comment: lp must be null terminated void ParseBlock(const char* lp) { CArray a; unsigned int i,n; int result; for(i=0;lp[i];i+=n) { if(!(n=ParseOneValue(lp+i,result)) break; a.Add( result ); } } unsigned int ParseOneValue(const char* lp,int& result) { unsigned int i; char* e; while(lp[i] && !isdigit(lp[i])) ++i; // trim leading non number chars if(!lp[i]) return 0; if((lp[i]!='0')||(lp[i]!='x')) // lp+i != "0x" hex prefix { // it seems to be decimal number result = strtol(lp+i,&e,10); return e-lp; } i += 2; result = strtol(lp+i,&e,16); return e-lp; }
sorry the html won't take the tabs. -
I hope to understand you right. The aim is to convert a variable length block of input data with hexadecimal numbers into an array to integers. If it' true try this:
// comment: lp must be null terminated void ParseBlock(const char* lp) { CArray a; unsigned int i,n; int result; for(i=0;lp[i];i+=n) { if(!(n=ParseOneValue(lp+i,result)) break; a.Add( result ); } } unsigned int ParseOneValue(const char* lp,int& result) { unsigned int i; char* e; while(lp[i] && !isdigit(lp[i])) ++i; // trim leading non number chars if(!lp[i]) return 0; if((lp[i]!='0')||(lp[i]!='x')) // lp+i != "0x" hex prefix { // it seems to be decimal number result = strtol(lp+i,&e,10); return e-lp; } i += 2; result = strtol(lp+i,&e,16); return e-lp; }
sorry the html won't take the tabs.How to store the data first in CArray object? am getting continous data output with just Length:204 0x02 0x90 0x02 0x8D 0x02................ LEngth:204 0x02 0x71 0x02 0x78 0x02 0x79 0x0 in C output window, how could i store certain set of data in CArray object?