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

Leave Comment

Your email address will not be published. Required fields are marked *

clear formSubmit