int total_val = 100;FILE *output;output = fopen("result.tcl", "a+");fprintf(output,"set total_value %ld \n",total_val);fclose(output);
source ./result.tcl puts “Total value $total_value”
Total value 100