PDA

Click to See Complete Forum and Search --> : Not Viewing Net Send "Result Message"


NiVEN
Dec 11th, 2002, 12:16 PM
I was wondering how I write code that takes away the message you recieve in DOS when for example writing "net send NiVEN hello".. you get a response that states "The Message was sent to NiVEN".. how do I do to make the program to hide that message?

is it possible?

CornedBee
Dec 11th, 2002, 02:15 PM
command > nul:

NiVEN
Dec 11th, 2002, 02:38 PM
where do I place that code line? This is the code which i'm using. where do I place the code you send me?



sprintf(wholeString,"net send %s %s"),user,message;
system(wholeString);

CornedBee
Dec 11th, 2002, 05:03 PM
sprintf(wholeString,"net send %s %s > nul:"),user,message;

nul: is a special redirect target in DOS, the same as /dev/nul in UNIX.

Note: this only redirects the standard output. stderr will still be the console, this means error messages will still be written to the DOS window.

NiVEN
Dec 12th, 2002, 08:06 AM
i doesnt work. It messes up something concerning the user name. Get an error message about net send not being able to send the message to that alias. and it worked perfectly before adding your code. do you see anything wrong in my code that I should correct?



#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>
#include <cstdlib>
#include <ctime>

int main()
{


char user[20];
char message[20];
int loops;
char wholeString[250];




cout << "Send To: ";
cin >> user;
cout << "Message (max 20 symbols): ";
cin >> message;
cout << "Send how many times: ";
cin >> loops;


for (int i = 0;i < loops;i++)

{


// Code before change
// sprintf(wholeString,"net send %s %s",user,message);

sprintf(wholeString,"net send %s %s > nul:"),user,message;
system(wholeString);

}




cout << "\n";
return 0;

}

CornedBee
Dec 12th, 2002, 09:10 AM
That's strange, it shouldn't happen...

NiVEN
Dec 12th, 2002, 10:56 AM
Have you tested the code i posted?

NiVEN
Dec 12th, 2002, 11:43 AM
i fixed the problem.. you had out the ")" in the wrong place in the code =). but thanx for your help

CornedBee
Dec 12th, 2002, 04:19 PM
oops, yeah