hi im trying to make a program that utilizes the net send command to
make a neat messenger. the only problem im having is that with char
arrays, i cannot make it send messages with spaces. another problem
that im having is with if statements using char arrays. for example:
so anyway here is my program. !!note: this program will only run if
you have windows XP or NT and your main drive is C.!!
thanx in advance!!
-glitch
make a neat messenger. the only problem im having is that with char
arrays, i cannot make it send messages with spaces. another problem
that im having is with if statements using char arrays. for example:
Code:
char cmd[2];
cin >> cmd;
if (cmd=="y"){
cout << "messaging again";
}
else if(cmd=="n"){
cout << "not messaging again";
}
else if{cmd=="ip"){
cout << "displaying ip info again";
}
so anyway here is my program. !!note: this program will only run if
you have windows XP or NT and your main drive is C.!!
Code:
#include <stdio.h>
#include <iostream.h>
#include <process.h>
#include <conio_mingw.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
int main(int argc, char *argv[])
{
bool magain = true;
bool ipconf = true;
bool nameagain = true;
char ip[50];
char message[999999];
char cmd[1];
while (ipconf==true){
nameagain=true;
magain=true;
spawnl(P_WAIT, "c:\\WINDOWS\\system32\\ipconfig.exe",
"c:\\WINDOWS\\system32\\ipconfig.exe", NULL);
while (nameagain==true)
{
magain=true;
cout << "enter IP or name of computer to send message to:
";
cin >> ip;
while (magain==true)
{
cout << "\nEnter message to send to "<<ip<<" : ";
cin >> message;
cout << "sending, please wait\n";
spawnl(P_WAIT, "c:\\WINDOWS\\system32\\net.exe",
"c:\\WINDOWS\\system32\\net.exe", "send ", ip, " ", message, NULL);
cout << "\nsend another message(y/n), change
user(c), display ipconfig(ip)\n";
cin >> cmd;
cout << cmd;
if (cmd=="y"){
magain=true;
}
else if(cmd=="n"){
magain=false;
nameagain=false;
ipconf=false;
}
else if(cmd=="c"){
magain=false;
}
else if(cmd=="ip"){
magain=false;
nameagain=false;
}
else{
cout << "im sorry, that was an invalid
command. program is now exiting\n";
magain=false;
nameagain=false;
ipconf=false;
}
}
}
}
system("PAUSE");
return 0;
}
thanx in advance!!
-glitch