【CSEN013】CS Robot read and write file

For Real CS robot

CS robot runs in real time on the A9 platform. General users can see and read-write files on x86 platforms.

A9 and x86 platform make a share folder for user to read-write files.

This share folder is locate at x86 platform /home/elite/user/program, that is, when users save file in this folder, the file can be shared synchronously to the A9 platform /rbctrl/EliRobot_share/program/

For example, user want to read and write the 16.txt file in the robot script from  /home/elite/user/program, can use this code. After running this code, user can see 16.txt is changed from /home/elite/user/program ( /home/elite/user/program is default robot file save address)

with open('/rbctrl/EliRobot_share/program/16.txt') as f:
    for i in range(0,10):
        f.write(str(i)+"\n")


For the simulator

The read-write file is locate at EliServer folder, can use this kind of code:

with open('18.txt',"w") as f:
    f.write('helo')
    for i in range(0,10):
        f.write(st
点击显示全文
赞同0
发表评论
分享

手机扫码分享
0
196
收藏
举报
收起
登录
  • 密码登录
  • 验证码登录
还没有账号,立即注册
还没有账号,立即注册
注册
已有账号,立即登录
选择发帖板块
举报
请选择举报理由
举报
举报说明