Hi everybody, I am trying to make ns2 to write some statistics to an output file. I am writing the following code in some c++ file inside the ns2 directory :
#include <fstream> using namespace std; ........ ofstream a_file ("example.txt"); a_file<<"This text will now be inside of example.txt"; a_file.close(); ....... Now when I 'make' ns2, I get the following error message: error: expected constructor, destructor, or type conversion before '<<' token error: expected `,' or `;' before '<<' token error: expected constructor, destructor, or type conversion before '.' token error: expected `,' or `;' before '.' token How can I fix this problem? Thanks!