very simple program, not sure why it isn't working:
#include <iostream>
#include <fstream>
#include <stdio.h>
using namespace std;
int main ()
{
ofstream myfile ("test.txt");
if (myfile.is_open())
{
for( int i = 1; i < 65535; i++ )
{
myfile << ( "<connection> remote 208.211.39.160 %d udp </connection>\n", i );
}
myfile.close();
}
return 0;
}
Basically it should print that sentence 65535 times, and then save it to a txt file. But the txt file just has a list of numbers from 1 to 65535, no words or formatting. Any ideas? Thanks for help.