我有一个扩展名为.gz的文件.当我尝试使用以下TCL命令读取和打印文件时,即使我能够在VI编辑器中看到内容,也无法读取文件.
我尝试使用以下TCL代码:
set of [glob *.gz ]
set op [open "$of" r]
set file_data [read $op]
set data [split $file_data "\n"]
foreach line $data {
puts " $line"
}
Run Code Online (Sandbox Code Playgroud) 我想在 TCL 中实现以下 C 代码:
Float power_pitch = 8
float offset = 7.5
float threshold = 100
for(i=power_pitch+offset ; i<= threshold ; i += power_pitch)
Run Code Online (Sandbox Code Playgroud)
我想在TCL中实现上面的forloop。我在 TCL 中尝试了以下代码:
set power_pitch 8
set offset 7.5
set threshold 100
for { set i [expr $power_pitch + $offset] } { $i <= $threshold } { incr i $power_pitch}
Run Code Online (Sandbox Code Playgroud)
但是当我执行上面的代码时,我收到以下错误:
预期的整数,但在执行 incr i $power_pitch 时得到“15.5”
你能帮我在TCL中实现上面的forloop吗?
我有一个数组如下
array = {aaaabbbcccccc}
在上面的数组中,"a"是4次,b是3次,c是6次
如果我的输入在数组之上,你能帮助我将proc输出为6吗?
谢谢