change write command

I'm trying to write a very simple MUD(multiple user dungeon) using c++ on a UNIX box.  I do not know network programming, and don't have time to learn it in the scope of the project.  What I would like to do is to simply use the write command to communicate with other users on the system.  I only want them to see what I send though, and not the extra message, eod junk that the write command currently uses.  Also, I want to use a variables in the message.  Does anyone know how to accomplish this, or if not where I can get the source code for the write command?

Any suggestions on other ways to accomplish this would be helpful too.  Thanks a lot.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

cartoon022100Connect With a Mentor Commented:
FILE *fp;
int a = 10;
char b[10] = "your string";
fp = fopen("/dev/pts/4","w");

/* the receiving termminal number,this can be obtained thru many i have hardcoded,also the permission should be given for write */


/* through this u can print values of variables onto a terminal */

echo $message > /dev/ttynn
scottd1978Author Commented:
that solves half the problem already.  Now all we have to do is figure out how to send a variable to the system

not a unix variable, but a variable from the c++ program ...
Try to do a "fopen("/dev/tty#","w")
and do ordinary file writes into the
use your variable to fprintf
it will work
if u dont succeed i'll send u the code for it

the above will work provided there is write permission for the receiving terminal

All Courses

From novice to tech pro — start learning today.