I'm making a program that makes use of the net send command in windows. Anyway, the problem is that i cant use strings as part of the argument in the system() command. I know that there is one way to fix the problem, and that is to have my program create and execute a batch file, but i wanted to know if there was an easier way. Here is my program.
Does anyone know a way to get it to work, or do i have to make a batch file?Code:#include <iostream> using namespace std; int main() { string message; cout<<"This program will send a message to everyone on the network.\nWhat do you want the message to say?\n"; getline(cin, message, '\n'); system("net send * " + message); /* I also tried: string command = "net send * " + message; system (command) */ cout<<"your message has been sent!\n"; cin.get(); cin.get(); }



LinkBack URL
About LinkBacks


