原创 TCL Open 命令

2012-12-3 12:14 4178 14 11 分类: MCU/ 嵌入式 文集: TCL/TK

open fileName

open fileName access

Description

This command opens a file, serial port, or command pipeline and returns a channel identifier that may be used in future invocations of commands like read, puts, and close. If the first character of fileName is not | then the command opens a file: fileName gives the name of the file to open, and it must conform to the conventions described in the filename manual entry.

The access argument, if present, indicates the way in which the file (or command pipeline) is to be accessed. In the first form access may have any of the following values:

r
Open the file for reading only; the file must already exist. This is the default value if access is not specified.
r+
Open the file for both reading and writing; the file must already exist.
w
Open the file for writing only. Truncate it if it exists. If it does not exist, create a new file.
w+
Open the file for reading and writing. Truncate it if it exists. If it does not exist, create a new file.
a
Open the file for writing only. If the file does not exist, create a new empty file. Set the file pointer to the end of the file prior to each write.
a+
Open the file for reading and writing. If the file does not exist, create a new empty file. Set the initial access position to the end of the file.

All of the legal access values above may have the character b added as the second or third character in the value to indicate that the opened channel should be configured with the -translation binary option, making the channel suitable for reading or writing of binary data.

In the second form, access consists of a list of any of the following flags, all of which have the standard POSIX meanings. One of the flags must be either RDONLY, WRONLY or RDWR.

tcl
PARTNER CONTENT

文章评论1条评论)

登录后参与讨论

coyoo 2012-5-3 11:13

如果要打开一个存在的文件并在原有的文件后面写入时,使用a选项。r和w选项会将原有内容清零。
相关推荐阅读
coyoo 2024-12-25 14:13
ALTERA Cyclone 10器件的使用-8:特定的上电顺序
概述 Intel 要求用户为其10代FPGA器件使用特定的上电和掉电顺序,这就要求用户在进行FPGA硬件设计的时候必须选择恰当的FPGA供电方案,并合理控制完整的供电上电顺序。经过在Cyclone 1...
coyoo 2024-12-22 11:46
AD9218子板在新处理板上表现的问题
概述 新的数据处理板融合了数字和数据处理功能模块,计划采用ADI的4通道串行ADC芯片代替之前的并行ADC。由于初次使用,所以初次设计时预留了AD9218的子板的插槽。 在调试AD9633功能的同时并...
coyoo 2024-12-14 17:15
在Cyclone 10 GX器件上实现高精度TDC探索
概述 Cyclone 10 GX器件的ALM结构与Cyclone V类似,所以在Cyclone 10 GX器件上实现TDC功能理论上是可以完全参考甚至移植自Cyclone V系列的成功案例。但是,现实...
coyoo 2024-12-10 13:28
Cyclone V GX FPGA设计TDC的优化问题
概述 通过前面的研究学习,已经可以在CycloneVGX器件中成功实现完整的TDC(或者说完整的TDL,即延时线),测试结果也比较满足,解决了超大BIN尺寸以及大量0尺寸BIN的问题,但是还是存在一些...
coyoo 2024-12-03 12:20
比较器检测模拟脉冲说明(四)
概述 说明(三)探讨的是比较器一般带有滞回(Hysteresis)功能,为了解决输入信号转换速率不够的问题。前文还提到,即便使能滞回(Hysteresis)功能,还是无法解决SiPM读出测试系统需要解...
coyoo 2024-11-16 13:54
不同ADC采样同一前端模拟信号时转换用时差异分析
概述 同一组前端模拟信号接入由不同型号ADC组成的模数转换电路时,采样后在FPGA中发现采样用时差异较大。本文主要分析这个时间差异形成的原因,并记录该差异产生对系统造成的影响。系统数字化简介 项目前端...
EE直播间
更多
我要评论
1
14
关闭 站长推荐上一条 /3 下一条