f



read file in tcl

how to read or call a file in tcl ?
0
8/11/2003 8:27:30 AM
comp.lang.tcl 23429 articles. 2 followers. Post Follow

9 Replies
568 Views

Similar Articles

[PageSpeed] 54

davidw@dedasys.com (David N. Welton) wrote in message news:<873cg837s7.fsf@dedasys.com>...
> prowarcraftplayer@yahoo.com (K Zewi) writes:
> 
> > how to read or call a file in tcl ?
> 
> 'call' a file?
> 
> Reading a file can be done with the 'read' command:
> 
> set fl [open "somefile"]
> set data [read $fl]
> 
> is a simple way to do it.  You want to look at the documents for those
> commands, and maybe 'fconfigure' if you want to read a binary file.


i still can't read the file
assume that the files contain of the koordinate of the polygon
and i would like to read them to replace the 
create poly command in tcl
can i do so?
is there any tutorial on this read file method on the web
thank you!!!!
0
8/11/2003 2:45:04 PM
On 11 Aug 2003, K Zewi wrote:

> i still can't read the file
> assume that the files contain of the koordinate of the polygon
> and i would like to read them to replace the 
> create poly command in tcl
> can i do so?
> is there any tutorial on this read file method on the web
> thank you!!!!

    http://wiki.tcl.tk/open
    http://wiki.tcl.tk/read
    http://wiki.tcl.tk/close

    http://www.tcl.tk/man/tcl8.4/TclCmd/open.htm
    http://www.tcl.tk/man/tcl8.4/TclCmd/read.htm
    http://www.tcl.tk/man/tcl8.4/TclCmd/close.htm

Michael

0
michael6504 (290)
8/11/2003 2:50:53 PM
try this 

set fo [open "filename" r]
while { ![eof $fo]} {
gets $fo line

to read the content of file line by line
0
8/11/2003 3:37:36 PM
K Zewi wrote:
> 
> i still can't read the file

Show us the error. Otherwise we have to spend time guessing what you 
mean by "can't". Is it because the file doesn't exist? You don't have 
permission? You're giving the wrong name to the command? You're using 
the wrong command? You're making quoting mistakes? It's working but you 
don't realize it...........?

0
bryan1 (353)
8/11/2003 3:49:07 PM
* prowarcraftplayer@yahoo.com (K Zewi)
| i still can't open the file with these command

Please show the error message you get.

| is the "somefile" mean "C:\WINDOWS\Desktop\sample.txt"

Read about the meaning of the \-character in the TCL language, then
try any of
   "C:/WINDOWS/Desktop/sample.txt"
   "C:\\WINDOWS\\Desktop\\sample.txt"
   {C:\WINDOWS\Desktop\sample.txt}

| or is there any tutorial within these command on the internet

http://mini.net/tcl
http://www.tcl.tk/man/tcl8.4/

R'
0
ralfixx (1283)
8/11/2003 4:01:52 PM
Ralf Fassel wrote:
> * prowarcraftplayer@yahoo.com (K Zewi)
> | i still can't open the file with these command
> 
> Please show the error message you get.
> 
> | is the "somefile" mean "C:\WINDOWS\Desktop\sample.txt"
> 
> Read about the meaning of the \-character in the TCL language, then
> try any of
>    "C:/WINDOWS/Desktop/sample.txt"
>    "C:\\WINDOWS\\Desktop\\sample.txt"
>    {C:\WINDOWS\Desktop\sample.txt}
> 
> | or is there any tutorial within these command on the internet
> 
> http://mini.net/tcl
> http://www.tcl.tk/man/tcl8.4/
> 
> R'
> 

I advise you to use Tcl portable commands such as [file join ...], [pwd] 
and [file dirname [info script]] to navigate through directories. Tcl 
will do all the nasty work for you (separating character, etc.).

Charles-Christophe.

0
8/12/2003 7:17:34 AM
i've done it 
thanks a lot
pals
0
8/12/2003 7:57:34 AM
* Charles Christophe THOMART <Charles-Christophe.Thomart@axlog.fr>
| I advise you to use Tcl portable commands such as [file join ...],
| [pwd] and [file dirname [info script]] to navigate through
| directories.

Good advice in most of the times, especially when using environment
variables to derive file names.  These might have \ as directory
separators, while your add-ons use /, so the na�ve approach gives you
something like c:\Programs\foo/bar/baz.  `file join' solves all this.

However, when it comes to `well known' literal file names (which I had
the impression the OP did use), I tend to avoid `file join', as in
  set file /foo/bar/baz
  set file c:/foo/bar/baz
vs.
  set file [file join / foo bar baz]
  set file [file join c:/ foo bar baz]

Plus, in literals, I never use \ as separator in my own code ;-)
R'
0
ralfixx (1283)
8/12/2003 10:13:51 AM
prowarcraftplayer@yahoo.com (K Zewi) wrote in message news:<36940419.0308110645.7211bc88@posting.google.com>...
> davidw@dedasys.com (David N. Welton) wrote in message news:<873cg837s7.fsf@dedasys.com>...
> > prowarcraftplayer@yahoo.com (K Zewi) writes:
> > 
> > > how to read or call a file in tcl ?
> > 
> > 'call' a file?
> > 
> > Reading a file can be done with the 'read' command:
> > 
> > set fl [open "somefile"]
> > set data [read $fl]
> > 
> > is a simple way to do it.  You want to look at the documents for those
> > commands, and maybe 'fconfigure' if you want to read a binary file.
> 
> 
> i still can't read the file
> assume that the files contain of the koordinate of the polygon
> and i would like to read them to replace the 
> create poly command in tcl
> can i do so?
> is there any tutorial on this read file method on the web
> thank you!!!!



try this:
proc highlightmap { c name } {
global hcolor
$c itemconfigure $name -fill $hcolor
global t
$t delete 0 end
$t insert end $name
}



proc posts { c } {
set ftypes {{{PostScript Files} {.ps}}}
set filename [tk_getSaveFile -filetypes $ftypes]
$c postscript -file $filename.ps -width 800 -height 400
}
0
jorntk (34)
8/17/2003 4:04:09 PM
Reply:

Similar Artilces:

Sourcing a TCL file from within a tcl file
I am a newbie which I am sure I don't need to state :) I am trying to create a variable with a TCL file that will source another tcl file when I type the variable name something like this if I enter A through my keyboard then source a.tcl Can someone show me how to do this thanks guy On Dec 10, 1:15=A0pm, guy <gcoletta2...@gmail.com> wrote: > I am a newbie which I am sure I don't need to state :) > > I am trying to create a variable with a TCL file that will source > another tcl file when I type the variable name > > something like this > > if I enter A through my keyboard =A0then source a.tcl > > Can someone show me how to do this > > thanks > guy What you are asking is not hard. Will your program have a graphical user interface? Aric On Dec 10, 3:26=A0pm, Aric Bills <aric.bi...@gmail.com> wrote: > On Dec 10, 1:15=A0pm, guy <gcoletta2...@gmail.com> wrote: > > > I am a newbie which I am sure I don't need to state :) > > > I am trying to create a variable with a TCL file that will source > > another tcl file when I type the variable name > > > something like this > > > if I enter A through my keyboard =A0then source a.tcl > > > Can someone show me how to do this > > > thanks > > guy > > What you are asking is not hard. =A0Will your program have a graphical > user interface? > > Aric no I am just using this script...

how to read file in tcl
in the condition that giving some coordinate of polygon in a directory and i have to read these file without using the command create poly how to call these file from the directory? In article <36940419.0308110031.66a5cd1@posting.google.com>, K Zewi <prowarcraftplayer@yahoo.com> wrote: >in the condition that >giving some coordinate of polygon >in a directory and i have to >read these file without using >the command create poly >how to call these file >from the directory? Did you ever get the help you sought? My guess is that readers found your question hard to understand <URL: http://wiki.tcl.tk/RequestHelp >. -- Cameron Laird <Cameron@Lairds.com> Business: http://www.Phaseit.net Personal: http://phaseit.net/claird/home.html ...

Dose there any tcl script to translate an file with embedded tcl
Hi I need to generate some big file, but there are rules for generate these files Ex . ============================== Start input a [0] wire input a [1] wire .. .. .. .. input a [1000] wire End ================================= Dose there any tcl script can help to translate a file with embedded tcl script into a new file For example this is a source file ======================== Start * set i 0 * for { set i 0 } { $i < 1000 } { incr i } { * puts input a [$i] wire * } End ========================== After Translate ======================= Start input a [0] wire input a [1] wire .. .. .. .. input a [1000] wire End ======================= Gogo12 wrote: > > Hi > I need to generate some big file, but there are rules for generate > these files > Ex . > ============================== > Start > input a [0] wire > input a [1] wire > . > . > . > . > input a [1000] wire > End > ================================= > > Dose there any tcl script can help to translate a file with embedded > tcl script into a new file > For example > > this is a source file > ======================== > Start > * set i 0 > * for { set i 0 } { $i < 1000 } { incr i } { > * puts input a [$i] wire > * } > End > ========================== > > After Translate > ======================= > Start > input a [0] wire > input a [1] wire > . > . > . > . > input a [1000] wire > ...

Read block of file in Tcl
Hi, I have an input file in the following format: ******************************** Name1 Name2 Row1 DEF 001 Row2 ABC DEG 003 Row3 EW EW 002 Row4 FF 0012 Row1 ADEF 1001 Row2 ARBC DEG 2003 Row3 EWW EW 0302 Row4 AB 0112 Name1 Name2 Row1 DSDEF 001 Row2 ABVC DEG 003 Row3 EDW EW 002 Row4 FVF 0012 Row1 AF 1001 Row2 ACRBC DEG 2003 Row3 ESWW EW 0302 Row4 AEB 0112 **************************************** I have to read this file and --> if I get "Name1" in any of the line, then I have to read the block of file from "Name1" to the first occurrance of "Row4". --> If I get "Row1" after the above reading is done, then I have to read the block of file from "Row1" to the first occurrance of "Row4". Can anyone help me out in doing this through TCL. Thanks and regards, Calvin calvin hobbes wrote: > > Hi, > > I have an input file in the following format: > ******************************** > Name1 > Name2 > Row1 DEF 001 > Row2 ABC DEG 003 > Row3 EW EW 002 > Row4 FF 0012 > Row1 ADEF 1001 > Row2 ARBC DEG 2003 > Row3 EWW EW 0302 > Row4 AB 0112 > Name1 > Name2 > Row1 DSDEF 001 > Row2 ABVC DEG 003 > Row3 EDW EW 002 > Row4 FVF 0012 > Row1 AF 1001 > Row2 ACRBC DEG 2003 > Row3 ESWW EW 0302 > Row4 AEB 0112 > **************************************** > I have to read this file and > --> if I get "Name1" in any of the line, > then ...

How to read a file using TCL
Hi, I am a new bee to TCL. I want to write a script that opens the file and reads it and prints to screen. I have tried the below. But doesn't works. set INFILE [open "temp" a+] set data [read $INFILE] set data [split $data "\n"] foreach line $data { puts $line } -Regards Swaroop Kumar Tata On 14 Mai, 10:39, Swaroop <swaroop.t...@gmail.com> wrote: > Hi, > I am a new bee to TCL. I want to write a script that opens the > file and reads it and prints to screen. I have tried the below. But > doesn't works. > > set INFILE [open "temp" a+] You're opening in "a" (append) mode, that is, the file pointer puts at the end. As you want to read the file, why not use mode "r", which is default anyway? So just do set INFILE [open temp] On May 14, 2:20 pm, suchenwi <richard.suchenwirth- bauersa...@siemens.com> wrote: > On 14 Mai, 10:39, Swaroop <swaroop.t...@gmail.com> wrote: > > > Hi, > > I am a new bee to TCL. I want to write a script that opens the > > file and reads it and prints to screen. I have tried the below. But > > doesn't works. > > > set INFILE [open "temp" a+] > > You're opening in "a" (append) mode, that is, the file pointer puts at > the end. As you want to read the file, why not use mode "r", which is > default anyway? So just do > set INFILE [o...

tcl code to read an image and write tcl code?
Does anyone know where I can find a tcl proc that would take an image, say a gif, and output pure tcl code that I could paste into a program? I saw something about a unix program that did something with mimes but I'm on windows. In article <4403BC94.447A7341@rocketship1.com>, Eric Taylor <et2@rocketship1.com> wrote: > > >Does anyone know where I can find a tcl proc >that would take an image, say a gif, and output >pure tcl code that I could paste into a program? > >I saw something about a unix program that did >something with mimes but I'm on windows. > > I think TkProE (http://tkproe.sourceforge.net) can do this. A quick look suggests that the procs TP_ImageToData & TP_ImageEncode might do what you want. Ted Eric Taylor wrote: > Does anyone know where I can find a tcl proc > that would take an image, say a gif, and output > pure tcl code that I could paste into a program? > > I saw something about a unix program that did > something with mimes but I'm on windows. > > Something like this ought to be pretty close (untested, but I think it's pretty close). It requires the base64 package from tcllib: package require base64 proc main {} { global argv set file [lindex $argv 0] set fd [open $file r] set rawdata [read $fd] close $fd set b64data [base64::encode $rawdata] puts "image create photo -data {\n$b64data\n}" } mai...

Reading a tcl file in C
I have a tcl configure file (a list of variables with values and comments) that I wish to read into an array in C (or better yet, Objective-C). Does anyone have any suggestions of how to do this, or have any public-domain or GPL code that does this? randall.h.wood@gmail.com wrote: > I have a tcl configure file (a list of variables with values and > comments) that I wish to read into an array in C (or better yet, > Objective-C). Does anyone have any suggestions of how to do this, or > have any public-domain or GPL code that does this? Can you give us a short example of what this file will look like? -- +--------------------------------+---------------------------------------+ | Gerald W. Lester | |"The man who fights for his ideals is the man who is alive." - Cervantes| +------------------------------------------------------------------------+ On Mar 13, 9:02 am, "Gerald W. Lester" <Gerald.Les...@cox.net> wrote: > randall.h.w...@gmail.com wrote: > > I have a tcl configure file (a list of variables with values and > > comments) that I wish to read into an array in C (or better yet, > > Objective-C). Does anyone have any suggestions of how to do this, or > > have any public-domain or GPL code that does this? > > Can you give us a short example of what this file will look like? > I apologize for the delayed response. EXAMPLE FOLLOWS: # Set the dire...

read an XML file in TCL
Hello I am looking to read an XML file into my TCL program and extract information. How do we read an XML file in TCL? Are there man pages that describe these? Thanks krithiga one way is: http://wiki.tcl.tk/tdom another (and faster, but should be used only for valid stuff) is http://wiki.tcl.tk/11020 Torsten Edler wrote: > another (and faster, but should be used only for valid stuff) is > I'm curious as to this assertion that the shallow regexp parser is faster than tdom, I would have expected things to be the other way around. Do you have a benchmark? Were you testing tdom building a DOM tree or just SAX parsing (the latter would be a fairer comparison)? My own brief benchmark (parsing the XML 1.0 spec, ~200KB) produced these results: proc ParseXMLRegexp xml { XML::Init $xml while 1 { lassign [XML::NextToken] type val attr etype if {$type eq "EOF"} { break } } } proc ParseXMLTdom xml { dom parse $xml doc } puts "Regexp: [time { ParseXMLRegexp $xml } 10]" puts "Tdom: [time { ParseXMLTdom $xml } 10]" output: Regexp: 2419835.7 microseconds per iteration Tdom: 52872.1 microseconds per iteration which makes tdom roughly 45X faster than the regular expression parser, and that's with tdom building and destroying a full DOM tree. -- Neil Hi Neil, i typed my answer a bit too fast and mixed up TclXML with TcLDOM. Few months ago i had to read and extract all data from an XML-...

tcl-gaul: Genetic Algorithms for Tcl. (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-gaul Tcl-gaul is a Tcl extension for genetic/evolutionary algorithm processing.It relies on the GAUL library: http://gaul.sourceforge.net/ * A genetic algorithm (GA) is a search technique used in computing to find exact or approximate solutions to optimization and search problems. Genetic algorithms are categorized as global search heuristics. They are a particular class of evolutionary algorithms that use techniques inspired by evolutionary biology such as inheritance, mutation, selection, and crossover. For an introduction to genetic algorithms visit: http://gaul.sourceforge.net/intro.html Platform: Linux (GAUL library dependency) Home page: http://sourceforge.net/projects/tcl-gaul/ Man page: http://tcl-gaul.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

tcl-pam: PAM authentication for Tcl (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-pam Tcl-pam is a Tcl interface to the PAM* service of Linux. It provides a Tcl package that allows Tcl scripts to use PAM to authenticate users and programs. It relies on linux-pam library: http://www.kernel.org/pub/linux/libs/pam/ * PAM (Pluggable Authentication Modules): A mechanism to integrate multiple low−level authentication schemes into a high−level application programming interface (API). This enables programs that rely on authentication to be written independently of the underlying authentication scheme. Platform: Linux Home page: http://sourceforge.net/projects/tcl-pam/ Man page: http://tcl-pam.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

tcl-syslog: Unix system logging for Tcl (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-syslog Tcl-syslog is a Tcl interface to the *nix syslog service. It provides a Tcl package that allows Tcl scripts to log messages to syslog. Platform: Linux/Unix Home page: http://sourceforge.net/projects/tcl-syslog/ Man page: http://tcl-syslog.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

tcl-mq: POSIX Message Queues for Tcl. (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-mp Tcl-mp is a Tcl interface to POSIX Message Queues*. It provides a Tcl package that allows scripts to create/open/close/unlink multiple parallel message queues, and to send/receive messages synchronously and asynchronously to/from them. * A POSIX message queue is an Inter-Process Communication mechanism available on Linux and some other POSIX-compliant operating systems. It allows to or more processes (or threads) to communicate under the same OS. The messages are buffered by the kernel, which gives them kernel persistency. A message queue can be thought of as a linked list of messages. Threads with adequate permission can put messages onto the queue, and threads with adequuate permission can remove messages from the queue. Each message is assigned a priority by the sender, and the oldest message of highest priority is always retrieved first. Unlike PIPES and FIFOS, no requirement exists that someone be waiting for a message to arrive on a queue, before some process writes a message to that queue. It's not even a requirement for both processes to exist at the same time. Read mq_overview(7) for more details Platform: Linux Home page: http://sourceforge.net/projects/tcl-mp/ Man page: http://tcl-mp.sourceforge.net/ Author: Alexandros Stergiakis alsterg On Sep 3, 11:37=A0am, Alexandros Stergiakis <alst...@gmail.com> wrote: > This is an announcement for a relatively new Tcl pro...

tcl-mmap: A POSIX mmap interface for Tcl. (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-mmap Tcl-mmap is a Tcl interface to the POSIX mmap* system call. It provides a Tcl package that allows Tcl scripts to: 1) Memory map files for improved access efficiency; 2) Share memory between related processes; 3) Easily implement cyclic persistent log files. * See the mmap(2) man page. Platform: Linux/Unix Home page: http://sourceforge.net/projects/tcl-mmap/ Man page: http://tcl-mmap.sourceforge.net/ Author: Alexandros Stergiakis On Sep 3, 11:48=A0am, Alexandros Stergiakis <alst...@gmail.com> wrote: > This is an announcement for a relatively new Tcl project: tcl-mmap > > Tcl-mmap is a Tcl interface to the POSIX mmap* system call. It provides > a Tcl package that allows Tcl scripts to: 1) Memory map files for > improved access efficiency; 2) Share memory between related processes; > 3) Easily implement cyclic persistent log files. > > * See the mmap(2) man page. > Great to see this and the other packages you made. Looking at the manpage it looks a bit misformatted before the usage example. Any specific reason to use GPL for this instead the usual Tcl/MIT/BSD style license used? Michael schlenk wrote: > On Sep 3, 11:48 am, Alexandros Stergiakis <alst...@gmail.com> wrote: >> This is an announcement for a relatively new Tcl project: tcl-mmap >> >> Tcl-mmap is a Tcl interface to the POSIX mmap* system call. It provides >> a Tcl package that...

read excel file from tcl in li
Hi everyone i wonder if anybody know if there is anyway to read excel file from tcl in linux? as tcom work only in windows Thanks in advance. On Jan 22, 2:03=A0pm, "m.gad" <mohamedsami...@gmail.com> wrote: > Hi everyone > > i wonder if anybody know if there is anyway to read excel file from > tcl in linux? > > as tcom work only in windows > > Thanks in advance. There is a small command-line tool "xls2csv" (in the catdoc package IIRC) which will convert what can be to CSV. Of course you'll lose Excel-specific metainformation. (Beware, there is also a Perl script by the same name, but in my experience the C one is just fine with fewer dependencies ;-) -Alex m.gad wrote: > i wonder if anybody know if there is anyway to read excel file from > tcl in linux? > > as tcom work only in windows Newer Excel versions can write in an XML format. This should be fairly easy to read from Tcl. Just make sure you have the proper file format. (I haven't really been doing much parsing, but we write lots of Excel reports from Tcl by just writing some XML. Works great as you can have all Excel features: just create what you want in Excel, save it as XML, then open it with an editor to see how Excel actually writes it) hth Ronnie ...

TCL code to read a following file
How to read the following file using arrays in a tcl code. I should store all the begincase ids in one variable and beginlist ids in one variable and contents between the BeginList and EndList in one variable and I should pass all these arguments to a another file. BeginList is dependent on BeginCase.. Each beginCase contain so many beginLists. BeginCase:1 BeginList:1 Stress EndList BeginList:3 Stress|(Min)|VonMises EndList BeginList:8 Stress // Elements, ByID, 12, 14, 67 EndList BeginList:9 Stress EndList BeginList:12 Stress EndList EndCase BeginCase:2 BeginList:(All) Displacement // Nodes, ByID, 1,45,67,104-106 Strain Energy|Strain Energy Strain Energy|Energy Density EndList EndCase BeginCase:3 BeginList:1 Displacement EndList EndCase On May 19, 3:36 pm, nehal <sowmya.ne...@gmail.com> wrote: > How to read the following file using arrays in a tcl code. > (nested constructs) Hint :use regsub to replace all your "begin foobar"s by "foobar {", and all your "end"s by "}". Then use [eval]. -Alex In article <1179600905.738853.34140@u30g2000hsc.googlegroups.com>, Alexandre Ferrieux <alexandre.ferrieux@gmail.com> wrote: >On May 19, 3:36 pm, nehal <sowmya.ne...@gmail.com> wrote: >> How to read the following file using arrays in a tcl code. >> (nested constructs) &...

Reading files in tcl that are unicode encoded
Hi, I saved a txt file from notepad in UTF-8 format (or unicode format, as these are the 2 options I have in windows notepad). I started a Wish shell in windows and when I do a glob *.txt, the file name is show in unicode encoded characters (even the file name is saved as unicode format). I want to display this file in wish text box so that it appears same as that in Notepad. Can I do that in Wish. If not what else has to be done to show this file n text box. I assume that if this can be shown in text box, the same holds for entry. Thanks Kiran Kiran Madabhushi wrote: > Hi, > I saved a txt file from notepad in UTF-8 format (or unicode format, as > these are the 2 options I have in windows notepad). I started a Wish > shell in windows and when I do a glob *.txt, the file name is show in > unicode encoded characters (even the file name is saved as unicode > format). I want to display this file in wish text box so that it > appears same as that in Notepad. Can I do that in Wish. If not what > else has to be done to show this file n text box. I assume that if > this can be shown in text box, the same holds for entry. > This should work, could stumble over the byte order markers Notepad places in error (http://sourceforge.net/tracker/index.php?func=detail&aid=800114&group_id=10894&atid=110894 ) package require Tk set file [tk_getOpenFile] set fd [open $file] fconfigure $fd -encoding utf-8 set text [read $fd] close $fd text .t -width...

TCL file reading enhancement idea
Earlier today I read a post where someone was having a problem getting 'tail' to work for reading a file. I also have a need to just read the end of file but I am trying to stay from exec OS APIs in my application and just stay with pure TCL. After thinking about this it occurred to me that a useful addition to TCL would be an implementation of 'tail' that would return some configurable value of lines (for example, the last 5 lines) from the end of a file. I have tried reading the whole file just to check for some data at the end. This works fine for small files but for large files it really slows down performance, especially if multiple large files are being simultaneously read. Earl Grieda wrote: > Earlier today I read a post where someone was having a problem getting > 'tail' to work for reading a file. I also have a need to just read the end > of file but I am trying to stay from exec OS APIs in my application and just > stay with pure TCL. After thinking about this it occurred to me that a > useful addition to TCL would be an implementation of 'tail' that would > return some configurable value of lines (for example, the last 5 lines) from > the end of a file. > > I have tried reading the whole file just to check for some data at the end. > This works fine for small files but for large files it really slows down > performance, especially if multiple large files are being simultaneously > read. &...

windows tcl to read unix files
Hi, I need to write a tcl script for MS windows to read 2 text files in unix server. These 2 text files have the same file name but different case letter (i.e. A.txt and a.txt) and they are in the unix system. The tcl script needs to be executed under MS windows and then through the network to read these 2 files. Does any one know how to do that? I am having troubles because the tcl script under MS windows treats these 2 files as one file (it does not distinguish the case letter). And so it only opens A.txt whether it read "A.txt" or "a.txt". Please let me know if anyone knows how to solve the problem. Any comment is appreicated. Thanks in advance --------------= Posted using GrabIt =---------------- ------= Binary Usenet downloading made easy =--------- -= Get GrabIt for free from http://www.shemes.com/ =- macray wrote: > > Hi, > > I need to write a tcl script for MS windows to read 2 text files in unix server. These 2 text files have the same file name but different case letter (i.e. A.txt and a.txt) and they are in the unix system. The tcl script needs to be executed under MS windows and then through the network to read these 2 files. > > Does any one know how to do that? I am having troubles because the tcl script under MS windows treats these 2 files as one file (it does not distinguish the case letter). And so it only opens A.txt whether it read "A.txt" or "a.txt". > > Please let m...

Tcl library for reading ELF files ?
Does anybody know wheather there is a Tcl library available for reading ELF files ? Thanks, Rolf. --------------------------------------------------------------- Rolf Schroedter, German Aerospace Center Remove .nospam to reply: mailto:Rolf.Schroedter@dlr.de.nospam ...

tcl-inotify: File & directory level notifications for Tcl. (extension)
This is an announcement for a relatively new Tcl project: tcl-inotify. Tcl-inotify is a Tcl interface to the linux kernel's inotify* service. It provides a Tcl package that enables Tcl scripts to monitor the file system changes at a file and directory level. A large number of file/directory actions can be monitored. A proc is executed asynchronously to notify for changes. * inotify is a Linux kernel subsystem that provides file system event notifications. It was written by John McCutchan with help from Robert Love and later Amy Griffis to replace dnotify. It was included in the mainline kernel starting from release 2.6.13, and could be compiled into 2.6.12 and possibly earlier releases by use of a patch. Its function is essentially an extension to filesystems to notice changes to the filesystem, and report those changes to applications. Home page: http://sourceforge.net/projects/tcl-inotify/ Man page: http://tcl-inotify.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

Tcl file from .txt file
Hi, I have a excel file. I need to change the excel file in to tcl file. I did = change the excel file in to txt file. but unable to change the txt file in = to tcl file. let me know any idea to change the txt file in to tcl file or = directly from the excel file in to tcl file.=20 your help is much more appreciated. thank you. On 11/14/14, 1:30 PM, yenilsuwal@gmail.com wrote: > Hi, > > I have a excel file. I need to change the excel file in to tcl file. I did change the excel file in to txt file. but unable to change the txt file in to tcl file. let me know any idea to c...

TCL/PHP/XML problem: I need to convert an XML file into a TCL list
My TCL proc, XML_GET_ALL_ELEMENT_ATTRS, is supposed to convert an XML file into a TCL list as follows: attr1 {val1} attr2 {val2} ... attrN {valN} This is the TCL code that does this: [TCL] set contents [read $fileID [file size ${fileName}.xml]]; close $fileID if {![string equal $switch -body]} { # ONLY DO THIS IF THE XML CONTENTS CONTAIN NO BODY - WILL UPGRADE AT A LATER DATE 11/24/2006 - PHIL global serverName if {![info exists serverName]} { global env source ./cgi_globals.tcl global serverName } if {[string length [info procs {URL_ENCODE}]] == 0} { source...

Komodo: Accessing widgets in the auto generated _ui.tcl from the associated .tcl file
I am using Komodo. I created a text widget and want to insert some text into it. The below is my ui.tcl file (ie. Dialog_ui.tcl). In my Dialog.tcl file I want to have access to the $base._text_log widget, so I can insert text into it. For eg. I've tried: ::Dialog::._text_log insert end "hello world!" And other variations, but have not succeeded. This seems to be something trivial, but I can't seem to figure it out. I also tried to get to the BASE variable, but was also unsuccessful. I guess my understanding of namespaces isn't correct. Is it even possible? Help is very very much appreciated. Thank you! # Below is the gui code in Dialog_ui.tcl # Declare the namespace for this dialog namespace eval Dialog {} package require Tk # Dialog::ui -- # # Create the UI for this dialog. # # ARGS: # root the parent window for this form # args a catch-all for other args, but none are expected # proc Dialog::ui {root args} { # this handles '.' as a special case set base [expr {($root == ".") ? "" : $root}] variable ROOT $root variable BASE $base # Widget Initialization text $base._text_log \ -height 0 \ -width 0 \ -xscrollcommand [namespace code [list _text_log_xscrollcommand]] \ -yscrollcommand [namespace code [list _text_log_yscrollcommand]] # Geometry Management grid $base._text_log -in $root -row 1 -column 1 \ -columnspan 1 \ -ipadx 0 \ -ip...

read file after EOF in Tcl 8.6
Hello! My program repeats attempts to read file after EOF condition appeared on it. The program looks for any new lines appended to that file. The program works with Tcl 8.5, but it doesn't see any new lines with Tcl 8.6. What can be wrong? Please help. Here's the test: $ cat read-after-eof.tcl puts "Tcl patchlevel: [info patchlevel]" set h [open ./read-after-eof.txt] read $h set text [clock seconds] exec cat >>./read-after-eof.txt << $text puts "gets after EOF returns: '[gets $h]'" $ echo "" >read-after-eof....

Web resources about - read file in tcl - comp.lang.tcl

Read-Only Memory
Read-Only Memory publishes high-quality books and articles that document defining moments in videogame history.

Leonard Read - Wikipedia, the free encyclopedia
( 1898-09-26 ) September 26, 1898 Hubbardston , Michigan , U.S. Leonard E. Read (September 26, 1898 – May 14, 1983) was an American economist ...

First Read
The first place for news and analysis from the NBC News Political Unit. Follow us on Twitter.

First Read
The first place for news and analysis from the NBC News Political Unit. Follow us on Twitter.

WhatsApp Lets Users Know When Messages Are Read
Users of Facebook-owned cross-platform messaging application WhatsApp can now tell when their messages have been read. (more…) New Career Opportunities ...

Must read: top 10 Android stories of the week
Android N is out, and N stands for nut tellin’! Google dropped a bombshell this week: a very early preview of Android N that we’re still digging ...

Significant Read: “She Wanted to Do Her Research. He Wanted to Talk ‘Feelings.’”
... of the sharpest tools in the shed. My own experiences as a student, scientist and mentor lead me to believe that such harassment is widespread. ...

The Donald Trump we don't get to see: The Donald Trump "that sits, and reads and thinks."
... are two Donald Trumps. I think there's one Donald Trump. But certainly you have all of this, and you have somebody else that sits, and reads ...

Ritholtz's Reads: Where That Money Went
Here are your Friday reads.

Murray: Careful to read everything that is relevant to him
INDIAN WELLS, Calif. (AP) — Scottish tennis star Andy Murray reacted to Maria Sharapova's failed drug test by noting that he's careful to read ...

Resources last updated: 3/13/2016 8:53:24 PM