acdbRToS 函数

cpp 复制代码
extern "C" int

acdbRToS(

ads_real val,

int unit,

int prec,

ACHAR * str);

val Value to format

unit Units into which the string is formatted as a valid AutoCAD LUNITS value; if -1, uses the current value of LUNITS

prec Number of decimal places of precision to include in the string; if -1, uses the current value of the AutoCAD LUPREC system variable

str Resulting string

Formats a floating-point value as a string.

The following table lists the valid values for the units argument.

Linear units values:

Mode value String format

1 Scientific

2 Decimal

3 Engineering (feet and decimal inches)

4 Architectural (feet and fractional inches)

5 Fractional

The current value of the AutoCAD DIMZIN dimensioning variable controls how acdbRToS() writes leading or trailing zeros to str.

If acdbRToS() succeeds, it returns RTNORM; otherwise, it returns an error code.

Include File

acedads.h

acdbRToS 函数是 AutoCAD 中的一个函数,用于将浮点数值格式化为字符串。

函数原型如下:

参数解释如下:

val:要格式化的值。

unit:将字符串格式化为的单位,作为有效的 AutoCAD LUNITS 值;如果为 -1,则使用当前的 LUNITS 值。

prec:要包含在字符串中的小数位数的精度;如果为 -1,则使用当前的 AutoCAD LUPREC 系统变量值。

str:格式化后的字符串的输出结果。

函数将一个浮点数值 val 格式化为一个字符串,并将结果存储在 str 中。格式化的字符串的单位和精度由 unit 和 prec 参数指定。

unit 参数的有效值如下:

线性单位值:

-1:科学计数法。

-2:十进制。

-3:工程单位(英尺和小数英寸)。

-4:建筑单位(英尺和分数英寸)。

-5:分数。

acdbRToS 函数将根据 AutoCAD 的 DIMZIN 尺寸变量的当前值,决定在结果字符串 str 中如何处理前导或尾随零。

如果 acdbRToS 函数执行成功,它将返回 RTNORM;否则,它将返回一个错误代码。

需要包含头文件 acedads.h 来使用 acdbRToS 函数。

相关推荐
无限进步_16 分钟前
C语言文件操作函数解析
c语言·开发语言·数据库·c++·后端·visual studio
_OP_CHEN44 分钟前
【算法基础篇】(二十六)数据结构封神!Trie 树从入门到爆杀算法题:拼音输入法、单词统计都靠它
数据结构·c++·算法·蓝桥杯·trie树·算法竞赛·acm/icpc
ULTRA??44 分钟前
C++类型和容器在Rust中的对应关系
c++·rust
明洞日记1 小时前
【设计模式手册016】中介者模式 - 解耦多对象交互
c++·设计模式·交互·中介者模式
李日灐1 小时前
C++STL:熟悉vector的底层实现,部分源码解析,迭代器失效和深层次浅拷贝
开发语言·c++
一只小bit1 小时前
Qt 信号与槽:信号产生与处理之间的重要函数
前端·c++·qt·cpp·页面
十五年专注C++开发1 小时前
sigslot: 一个轻量级实现观察者模式的C++开源库
c++·观察者模式·开源
千千道1 小时前
QT上位机作为FTP客户端上传多文件
c++·qt
屿筱1 小时前
vscode 关于C/C++的环境配置
c++·ide·vscode
程序喵大人1 小时前
C++ MCP 服务器实现
开发语言·c++·项目·mcp服务器