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
 












Thanks for reading my news about First Tcl script for beginners: "Hello World" at my blog Tic Droid if you want too share this article, please put the resource, and if you think this article is very usefully dont forget to bookmark this site with CTRL + D on your keyboard to web browser.

New and Hot Article's :

  • Custom Rom Mokee Lollipop for Lenovo A7000
  • [Custom ROM] [MTK6753] MIUI 8.2 v7.1.5 Marshmallow For Lenovo K4 Note A7010a48
  • How to Charge iPhone 7 and any other iPhone device wirelessly
  • How to ROOT Almost ALL Android Phones
  • Cara Root dan Pasang TWRP di Xiaomi Redmi 3s | Prime
  • Galaxy S7 and S7 Edge Android 7.1.1 Nougat update rolling out on January of 2017
  • Make your Internet Browsing Speed more faster than ever before with the recommended apps
  • Spesifikasi Andromax B (A26C4H) 4G LTE Dengan Fitur VOWIFI
  • [ROM] MIUI V7 For Cherry Mobile Flare S3 Octa
  • How to Increase Wi-Fi Connection Time
  • More Articles :