代号小一

看不到子标题【表情】

导航

关于 MAXScript 逐行写入文本

官方帮助文档FileStream Values部分有相关介绍.

fn format_txt filepath filetext =
(
    if doesFileExist filepath == true 
        then
    (
        fin = openfile filepath mode:"r+"
        seek fin #eof
        txt = filetext + "\n"
        format txt to:fin
        close fin
    )
    else
    (
        newfile = createFile filepath
        close newfile
        format_txt filepath filetext
        )
    )  -- 逐行写入文本
format_txt "C:\Users\Administrator\Desktop\2.txt" "你好MAXScript"

每次都会在文档结尾处写入,如果文件不存在则自动创建.

posted on 2014-09-08 00:26  代号小一  阅读(2404)  评论(0编辑  收藏  举报