[ns] making ns2 to write to an output file
nalinaksh gaur
nalinaksh at gmail.com
Thu Mar 30 21:48:52 PST 2006
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!
More information about the Ns-users
mailing list