Hi, I am looking for a good, fast method for communication between two c++ programs. I am making a 3D mouse pointer and need to send the three coordinates to another program that presents them graphically. At the moment I am using a file, but opening and closing a little file up to 40 times per second cant be ideal...
At the moment it looks like this:
Code to send coordinates in Prog1:
Code:
ofstream fout("c:\\xyz.txt");
fout << x << " " << y << " " << z;
fout << flush;
fout.close();
(x, y, z are doubles)
Code to recieve coordinates in Prog2:
Code:
ifstream fin("c:\\xyz.txt");
if(fin.good())
{
fin >> X >> Y >> Z;
}
fin.close();
Any better ideas?
My googling before finding this forum suggested me sockets or pipes, but I cant get it working. Any example is welcome!
Thanks!!
/Tomas B
EDIT: I am using Windows XP and Visual Studio 2005