1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| #include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
char msg[20];
string net = "net send ";
char* resultat;
int main(int argc, char *argv[])
{
system("@echo off");
system("title ... Net msg ...");
system("color 0a");
system("cls");
system("net start \"Affichage des messages\"");
system("cls");
system("color 0b");
size_t size = net.size() + 1;
char * buffer = new char[ size ];
strncpy( buffer, net.c_str(), size );
for(int i = 0; i==0;)
{
cout << " Tapez :\n";
cout << "\tv : pour voir les utilisateurs connects\n";
cout << "\tq : pour quiter\n";
system("echo.");
system("echo.");
cout << ">: ";
cin >> msg;
if(strcmp(msg, "q")==0) {
i++;
} else {
if(strcmp(msg, "v")==0) {
cout << "Attend ...\n";
system("net view");
} else {
scanf(resultat, "%s%s", buffer, msg);
cout << resultat;
system(resultat);
system("cls");
}
}
}
system("color 0a");
system("net stop \"Affichage des messages\"");
return EXIT_SUCCESS;
} |
Partager