Announcement

REXYGEN forum has been moved. This one is closed.
Head over to the new REXYGEN Community Forum at https://forum.rexygen.com.

Looking forward to meeting you there!
 

#1 2017-05-02 13:16:12

uhnila_malina
Member
Registered: 2017-05-02
Posts: 2

REXLANG parse buffer

I'm using read function to receive data from socket.

Read(socket, buffer, 1000);

Here is an exapmle of recived data.

+00.014 +00.321 +09.878 +00.000 -00.007 -00.001 +01.076 +08.606 +20.051 000016350 146803493

Is it posible to separate each nuber by using GetExtDouble();??? How??

Offline

#2 2017-05-03 21:43:24

tomáš čechura
Administrator
Registered: 2016-02-22
Posts: 371

Re: REXLANG parse buffer

Hi,

I would suggest to use

long Read(long handle, string data[], long count)

to read the data from socket directly to String variable.

Data can be parsed using  String oriented functions such as:

long strfind(str,substr); // find space occurrence
string strsub(str,idx,len); // parse number

Hope it will guide you to the right direction.

If you require any further information, let me know.

Regards, Tomas

Offline

#3 2017-05-04 08:36:42

uhnila_malina
Member
Registered: 2017-05-02
Posts: 2

Re: REXLANG parse buffer

Thank you.

Any suggestions how to convert resulting string to double?

Offline

#4 2017-05-04 21:05:40

tomáš čechura
Administrator
Registered: 2016-02-22
Posts: 371

Re: REXLANG parse buffer

Glad I could help.

Look for

double str2double(str)

in order to convert string to double.

Regards, Tomas

Offline

Board footer

Powered by FluxBB