Research breakthrough possible @S-Logix pro@slogix.in

Office Address

Social List

How to pass the variable c++ to tcl using NS2?

  • The variable (total value) in c++ is passed to tcl as follows.
    C++ part :

    int total_val = 100;FILE *output;output = fopen("result.tcl", "a+");fprintf(output,"set total_value %ld \n",total_val);fclose(output);

  • TCL part :

    source ./result.tcl
    puts “Total value $total_value”

  • Result :

    Total value 100