putting variables together in system

This is a discussion on putting variables together in system within the C++ Programming forums, part of the General Programming Boards category; quick example of what i meant: Code: //Steven Billington //Main.cpp //rod@cprogramming.com #include <iostream> #include <cstdlib> #include <conio.h> #include <fstream> using ...

  1. #16
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    quick example of what i meant:

    Code:
    //Steven Billington
    //Main.cpp
    //rod@cprogramming.com
    
    #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");
    }

  2. #17
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    Stupid tabbing from VC++, heres the cpp

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. esbo's data sharing example
    By esbo in forum C Programming
    Replies: 49
    Last Post: 01-08-2008, 11:07 PM
  2. Replies: 3
    Last Post: 06-13-2005, 08:28 AM
  3. Why Can't C++ Be Used to Develop Operating System?
    By Antigloss in forum C++ Programming
    Replies: 7
    Last Post: 05-27-2005, 07:16 AM
  4. Putting variables in SYSTEM
    By mycro in forum C++ Programming
    Replies: 3
    Last Post: 05-29-2003, 08:59 PM
  5. System Calls && Variables
    By Okiesmokie in forum C++ Programming
    Replies: 6
    Last Post: 03-06-2002, 09:10 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21