List Info

Thread: Using the copy function to separate data




Using the copy function to separate data
user name
2007-01-04 21:13:44

ALL,

I have a telnet connection to a server computer that constant broadcast data to me each second. The data that I receive has spaces and tabs in the middle of the string. Once I receive the data I remove all spaces and tabs to get a single stream of data. After I receive the stream I attempt to parse the data into segments using the copy function.

My problem is this when I look at the stream the data looks fine but when I use the copy funtion it does not work properly on the data.

Here is an example :

Single stream from a telnet connection

0.0000.1370.000

Data := ' 0.0000.1370.000'

Copy (Data, 1, 3) yield value 0.0 which is fine.
Copy (Data, 6, 8) yields value 0.0000.0 which is wrong.
Copy (Data, 11, 13) yields value 0.0000.0000.0 which is wrong.

I'm not sure why I am not receiving the correct data.

r/Curtis..




__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
Using the copy function to separate data
user name
2007-01-04 21:29:00

Curtis cloud wrote:
> Single stream from a telnet connection
>
> 0.0000.1370.000
>;
> Data := ' 0.0000.1370.000'
>
> Copy (Data, 1, 3) yield value 0.0 which is fine.
>; Copy (Data, 6, 8) yields value 0.0000.0 which is wrong.
> Copy (Data, 11, 13) yields value 0.0000.0000.0 which is wrong.
>
> I'm not sure why I am not receiving the correct data.

Given those four lines of code, _none_ of the results are correct. The
first call should return ' 0.', not '0.0' since there's still a space as
the first character of Data.

If you remove the space, then the returned strings should be '0.0',
'0.1370', and '0.000', respectively.

Please copy and paste real compilable code that demonstrates how Copy
doesn't work properly.

--
Rob

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )