# Position to String

**URL:** <https://tech-community.robotics.abb.com/t/position-to-string/7130>\
**Category:** RobotStudio\
**Tags:** current-position, cpos, to-string, pos-to-str\
**Created:** [May 2, 2016, 7:01pm UTC](https://tech-community.robotics.abb.com/t/position-to-string/7130 "2016-05-02T19:01:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteveMob](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/stevemob/32/1600_2.png) [@SteveMob](https://tech-community.robotics.abb.com/u/SteveMob)\
**Post date:** [May 2, 2016, 7:01pm UTC](https://tech-community.robotics.abb.com/t/position-to-string/7130/1 "2016-05-02T19:01:04Z")

</div>

Hello,

I have a VAR pos that I am reading the position of the robot with using CPos. I am trying to send that data to LabVIEW from RAPID via Socket communication. However, sockets can only send data or strings. So my question is, is there way to go from Position data to String data? This is some of my code to help visualize:

!(Robot/RAPID is client, LabVIEW is server)  
VAR pos Current\_Position;  
VAR string str;  
PROC main()  
MoveJ Home,v150,z0,tool0;  
WaitTime 2;  
!Socket connection/send/receive data…  
!  
!  
!  
!  
!  
**MoveJ myRobtarget,v100,fine\Inpos:=inpos50,tool0,\WObj:=wobj0;**  
**WaitTime 1;**

**Current\_Position :=CPos(\Tool:=tool0,\WObj:=wobj0);**  
**!SocketSend client\_socket\Str:=Current\_Position;**  
**str:=Strtoval(Current\_Position,3);**

ELSE  
TPWrite "Unhandled command: "\Num:=command;  
ENDIF  
ENDIF  
IF ERRNO\>0 THEN  
IF ERRNO=ERR\_SOCK\_TIMEOUT THEN  
ELSE  
i:=0;  
ENDIF  
ENDIF  
WaitTime 1;  
ENDIF  
ENDWHILE  
ENDPROC

Thanks for any help!  
SM
