09-17-2009 12:56 PM
Hi,
I'm reading a packet with TCP Read. The data out is a string o 248 bytes. I need to convert that to an array of 62 U32's. I tried type casting in a loop but that didn't work.
What's the correct way to perform the conversion?
Thanks.
Solved! Go to Solution.
09-17-2009 01:05 PM
09-17-2009 01:05 PM
09-17-2009 01:07 PM
Harold Timmis wrote:
there are string convertions uder the string pallette that may help
Why would you go through a string?
To original poster: As Dennis indicated, you do not need a loop. Byte endianness may be a problem, though. Do you know what this is for the source data?
09-17-2009 01:15 PM
I'm using a string because that's what TCP Read's data out is. Is there some way to change that?
09-17-2009 01:18 PM
When I simply type casted, all I got was a single value I did not get an array. I think the single value was simply the first four bytes of the string. That's why I tried a loop.
I think I'm misssing something with type casting.
09-17-2009 01:22 PM
Smercurio_fc is right. I forgot about the endianess. Instead of the type cast, you could use the Unflatten From String. Depends on what is generating the data.
No, the TCP/IP Read output is only a string.
09-17-2009 01:22 PM
JohnSantaFe wrote:When I simply type casted, all I got was a single value I did not get an array. I think the single value was simply the first four bytes of the string. That's why I tried a loop.
I think I'm misssing something with type casting.
Did you do this:
09-17-2009 01:23 PM - edited 09-17-2009 01:24 PM
JohnSantaFe wrote:When I simply type casted, all I got was a single value I did not get an array. I think the single value was simply the first four bytes of the string. That's why I tried a loop.
I think I'm misssing something with type casting.
You definitely did something wrong if the type case did not return an array. Are you sure you have a U32 array wired to the type input?
09-17-2009 02:25 PM
Ah that's it. I had wired just an integer to the type for the type cast and not an integer array.
Thanks to everyone for your help.