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.