CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 文档中心

写行(AutoLISP)

2023-1-7 14:48| 发布者: admin| 查看: 261| 评论: 0|来自: AutoCAD

摘要: 将字符串写入屏幕或打开的文件

将字符串写入屏幕或打开的文件

支持的平台:视窗和 Mac OS

签名

(write-line str [file-desc])
str

类型:字符串

文本值。

文件描述

类型:文件

打开的文件的文件描述符。

返回值

类型:字符串

str,以正常方式引用。写入文件时省略引号。

发布信息

    释放:

  • Windows 上的 AutoCAD R12 及更高版本
  • Mac OS 上的 AutoCAD 2011 及更高版本

历史

    AutoCAD 2021

  • str参数以前接受 ASCII 文本字符串或字符,但现在接受 Unicode 文本字符串或字符。
  • 返回值已修改为支持 Unicode 字符,并且可能与早期版本不同。
  • LISPSYS 系统变量控制使用哪个 AutoLISP 引擎以及函数的行为。
    • 0 - ASCII 字符支持(旧行为)
    • 1 或 2 - Unicode 字符支持
    注意:更改 LISPSYS 系统变量的值后,必须重新启动 AutoCAD 才能使更改生效。

例子

窗户

打开文件:

(setq f (open "c:\\my documents\\new.tst" "w"))
#<file "c:\\my documents\\new.tst">

用于将一行写入文件:write-line

(write-line "To boldly go where nomad has gone before." f)
"To boldly go where nomad has gone before."

在关闭文件之前,不会以物理方式写入该行:

(close f)
nil
苹果操作系统

打开文件:

(setq f (open "/my documents/new.tst" "w"))
#<file "/my documents/new.tst">

用于将一行写入文件:write-line

(write-line "To boldly go where nomad has gone before." f)
"To boldly go where nomad has gone before."

在关闭文件之前,不会以物理方式写入该行:

(close f)
nil

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 15:28

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部