Hi everyone,

I have to create 16 separate files for 16 nodes and write something in it.
Is there any way in which i do not have to separately create sixteen files.
//// sompe part of code which i am using

file2.open("Node0.txt");//Node0.txt is the file of ofstream type
		{
	cout<<"I received a packet from node 0";
	file2<<" Hello I received a packet from node 0";
	file2.close();
		}

Use the number of the node as part of the file name. File for Node 4 is Node04.txt for example.

If you know stringstreams, you can generate the filename that way. If not, you can use ssprintf() . Include the cstdio header.