Re: tcl command "type"



thank you for helping.
my idea was the following : i am coding a little application and
sourcing several files in a sort of main file. In order to check if
the files were correctly sourced i thaught of dumping them ???
Anyway with your code I will be able to make my dumping.
Sorry if my checking solution is "exageratly newbee-ish".
friendly
jerome

On Sat, 31 Dec 2005 19:14:12 GMT, Bryan Oakley
<oakley@xxxxxxxxxxxxxxxxxxxx> wrote:

>suchodj@xxxxxxxxxx wrote:
>> Hello
>> i am under windows xp family and Tcl/Tk 8.4
>>
>> in the book "SAMS teach yourself Tcl/Tk" isbn 0-672-31749-4
>> page 154 listing 9.6 i find the following code
>>
>> source myfile.tcl
>> type myfile.tcl
>>
>> when i code it i obtain the following error
>>
>> invalid command name "type"
>>
>> in the man pages "http://www.tcl.tk/man/tcl8.4/TclCmd/"; if cannot find
>> this command.
>>
>> my question is: if after having source any myfile.tcl i want to
>> print it in the console is there a command to do it ?
>
>No, there is not. There are a myriad of ways to do this, though I'm
>puzzled why you would need to. You can simply open the file up with your
>editor of choice.
>
>If you really want the contents dumped to the screen, you can read it in
> and print it out. Perhaps the SAMS book has you write a procedure to
>do that, and that is what the "type" command is.
>
>For example, you can enter the following interactively or put it in
>myfile.tcl:
>
>proc type {filename} {
> if {![file exists $filename]} {
> return -code error "file \"$filename\" doesn't exist"
> }
> if {![file readable $filename]} {
> return -code error "file \"$filename\" isn't readable"
> }
> set f [open $filename r]
> set data [read $f]
> close $f
> return $data
>}
>
>If you are running interactively, doing 'type myfile.tcl' at the prompt
>(without the quotes) will show the contents of the file. If you put the
>'type myfile.tcl' command in a script you will need to explicitly print
>out the output from the type command:
>
> puts [type myfile.tcl]
> -or-
> set result [type myfile.tcl]
> puts $result
>
>The reason is that when running interactively, tclsh and wish will
>automatically print out the result of a command when it is run as a
>convenience.
>
>

.



Relevant Pages

  • Re: Changing Uppercase filenames into Lowercase
    ... uppercase filename to a lowercase filename, ... foundfile = f$searchcommand line. ... Based on a command procedure by Willem Grooters which was ...
    (comp.os.vms)
  • Re: Pass command line file name parameter
    ... Then the document class has a copy of the filename, ... No need to access the original command line at all. ... want the user to see all the labels as they would be printed. ... filename or any other variable of your CWinApp class. ...
    (microsoft.public.vc.mfc)
  • Re: CStdioFile::Open gives error "No error occurred"
    ... I would avoid GetErrorMessage and just use FormatMessage on the error code itself, ... presume this is *not* the filename you planned to open, so why are you using m_lpCmdLine? ... there is a serious question here as to whether or not the command line has any ... Use the debugger, it is a very useful tool. ...
    (microsoft.public.vc.mfc)
  • Re: Cannot delete directory
    ... "Glenn" wrote in message ... > in a command window. ... >>window is a "normal" window. ... >>be a valid 8.3 filename - even if it has somehow been ...
    (microsoft.public.win2000.file_system)
  • Re: command line input and output
    ... Alternatively the first argument was a legal filename but it didn't exist, ... If there were no command line ... Microsoft Powerstation 4.0. ... qomputing dot demon dot co dot uk-- ...
    (comp.lang.fortran)