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 函数。

相关推荐
tan180°1 小时前
MySQL表的操作(3)
linux·数据库·c++·vscode·后端·mysql
彭祥.3 小时前
Jetson边缘计算主板:Ubuntu 环境配置 CUDA 与 cudNN 推理环境 + OpenCV 与 C++ 进行目标分类
c++·opencv·分类
lzb_kkk3 小时前
【C++】C++四种类型转换操作符详解
开发语言·c++·windows·1024程序员节
胖大和尚5 小时前
clang 编译器怎么查看在编译过程中做了哪些优化
c++·clang
钱彬 (Qian Bin)6 小时前
一文掌握Qt Quick数字图像处理项目开发(基于Qt 6.9 C++和QML,代码开源)
c++·开源·qml·qt quick·qt6.9·数字图像处理项目·美观界面
双叶8367 小时前
(C++)学生管理系统(正式版)(map数组的应用)(string应用)(引用)(文件储存的应用)(C++教学)(C++项目)
c语言·开发语言·数据结构·c++
源代码•宸7 小时前
C++高频知识点(二)
开发语言·c++·经验分享
jyan_敬言8 小时前
【C++】string类(二)相关接口介绍及其使用
android·开发语言·c++·青少年编程·visual studio
liulilittle9 小时前
SNIProxy 轻量级匿名CDN代理架构与实现
开发语言·网络·c++·网关·架构·cdn·通信
tan77º9 小时前
【Linux网络编程】Socket - UDP
linux·服务器·网络·c++·udp