-
quick example of what i meant:
Code:
//Steven Billington
//Main.cpp
//[email protected]
#include <iostream>
#include <cstdlib>
#include <conio.h>
#include <fstream>
using namespace std;
class NetSend
{
public:
void ListAlias();
void Message();
ofstream file;
};
int main ()
{
NetSend ClassObj;
ClassObj.ListAlias();
ClassObj.Message();
return(0);
}
void NetSend::ListAlias()
{
//open (or create) batch file.
file.open("c:\\temp.bat");
cout << "Generating PC List....." << endl;
file << "net view ";
//close the batch file
file.close();
//execute batch file
system("c:\\temp.bat");
}
void NetSend::Message()
{
char ip[100];
char message[250];
cout<<"\nEnter IP: ";
cin.getline(ip, 99);
cout<<"Message: ";
cin.getline(message, 249);
//open (or create) batch file.
file.open("c:\\temp.bat");
cout << "Creating Batch file please wait...." << endl;
//write the net send command and its arguments
//to the batch to be executed
file<<"net send " << ip << " " << message << " ";
//close the batch file
file.close();
//execute batch file
system("c:\\temp.bat");
}
-
Stupid tabbing from VC++, heres the cpp