IDL输出txt换行的问题

本文介绍如何通过设置openw函数的width关键字来调整printf输出的文本宽度。默认情况下,width为80,即每行打印80个字符后换行。若需每行输出六十个数,则需调整width值以适应数字位数及间隔。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

直接用printf输出的txt每行的内容有限制,所以百度了一下

设置openw函数的width关键字,该关键字决定了打印的宽度(column),默认情况下width=80,也就是打印80个字符后换行。如果你要每行输出六十个数,那么width应该大于等于(数字位数+数字后空格/制表符数)*60.

colcon build --packages-select learningAction WARNING: Package name "learningAction" does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, underscores, and dashes. Starting >>> learningAction --- stderr: learningAction CMake Error at /opt/ros/humble/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:59 (message): execute_process(/usr/bin/python3 -m rosidl_adapter --package-name learningAction --arguments-file /home/ly/mySpace/build/learningAction/rosidl_adapter__arguments__learningAction.json --output-dir /home/ly/mySpace/build/learningAction/rosidl_adapter/learningAction --output-file /home/ly/mySpace/build/learningAction/rosidl_adapter/learningAction.idls) returned error code 1: Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/__main__.py", line 19, in <module> sys.exit(main()) File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/main.py", line 53, in main abs_idl_file = convert_to_idl( File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/__init__.py", line 29, in convert_to_idl return convert_action_to_idl( File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/action/__init__.py", line 28, in convert_action_to_idl action = parse_action_string(package_name, input_file.stem, content) File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/parser.py", line 902, in parse_action_string goal_message = parse_message_string( File "/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_adapter/parser.py", line 544, in parse_message_string msg = MessageSpecification(p
最新发布
03-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值