Cari Blog Ini

Diberdayakan oleh Blogger.
Selasa, 07 Agustus 2012

First Tcl script for beginners: "Hello World"

First Tcl script for beginners: "Hello World" - welcome to the blog Software Gadget the end of this much calm product information launcing, yes every day there are always products that are removed from various brands, both physical hardware products and software that need new knowledge to use it, well now we will discuss first about First Tcl script for beginners: "Hello World" as you search we have collected a lot of data to make this information as complete as possible for you, please read:

Articles : First Tcl script for beginners: "Hello World"
full Link : First Tcl script for beginners: "Hello World"

You can also see our article on:


First Tcl script for beginners: "Hello World"

Hope you all have installed ns2 , now we can go for coding
As the ns2 simulations work on tcl scripts so we should know about tcl
Here some simple steps to write the "hello world" program in tcl

we can write tcl codes in two ways in interactive mode and in batch mode

first we can have look to interactive mode 

1.open the terminal
             type  $ ns
2. a command prompt open
         Create a new simulator object by using the command
                        set ns [ new Simulator ]

This is Usually the first non-comment statement in ns-2 script 
- Initialize the packet format
   - Create a scheduler (default is a calendar scheduler)
   - Create a “null agent”

3.  to print text on screen we use puts command
               $ns at 1 "puts "\Hello World\""
    here we Schedule an event to write at the time 1 
      by this script simulator instance "ns" writes "hello World"
4.  now we have to exit the simulator object
                         $ns at 1.5 "exit"

 5. now we have to run the simulator object,
                      $ns run
this starts ns
           
and this prints hello world

In batch mode  its much simple

open a text editor and write the codes there and save it with .tcl  file extention 

 expamlpe

 hello.tcl :

set ns [new Simulator]
$ns at 1 "puts \"hello world\""
$ns at 1.5 "exit"
$ns run

open the terminal and execute the hello.tcl by
            $ ns hello.tcl
 














so much information First Tcl script for beginners: "Hello World"

hopefully the information First Tcl script for beginners: "Hello World" that we provide can be useful for you in the set of technology products that fit your daily needs,

have just read the article titled First Tcl script for beginners: "Hello World" if you feel useful information and you want to bookmark or share please use the link http://ramblingsofker.blogspot.com/2012/08/first-tcl-script-for-beginners-world.html and do not forget to go back to this blog if you want to know information about the latest gadgets.

Tag :
Share on Facebook
Share on Twitter
Share on Google+
Tags :

Related : First Tcl script for beginners: "Hello World"

0 komentar:

Posting Komentar