Hello, I finally wrote a usefull peice of code for something that I am doing, I was going to have to type in over 3000 ports if i didnt know how to code so it took me 5 minutes to write a code for it but i just found out I cant copy from the command prompt so i need to know how can I mod this code to write to a file?
Code:
#include <iostream>
using namespace std;
int main()
{
int PortNumberBig;
cout<<"3658,6667,6668,6669,";
PortNumberBig=40000;
while(PortNumberBig<43000)
{
cout<<PortNumberBig<<",";
PortNumberBig++;
}
cout<<"45000,45001";
cin.get();
return 0;
}
Isnt it pretty lol
EDIT:
Got it I think
Code:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int PortNumberBig;
ofstream a_file("Ports.txt");
a_file<<"3658,6667,6668,6669,";
PortNumberBig=40000;
while(PortNumberBig<43000)
{
a_file<<PortNumberBig<<",";
PortNumberBig++;
}
a_file<<"45000,45001";
a_file.close();
cin.get();
return 0;
}
Pretty.