| | |
how to share data between two simultaneously running programs?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2006
Posts: 2
Reputation:
Solved Threads: 0
Hi all,
I am trying to share data between two simultaneously running programs. I am writing the output of one program to a file named xpos.out and reading the data in it from an other program which is running simultaneously. The value in xpos.out changes each time. So when i try to read this in the next cylce i never get the updated value.
I am following a simple procedure:
In one program iam writing it to xpos.out and immidiately closing it. and in another program iam reading the data in xpos.out. Only the first value is getting repeated.
Any help regarding this would be highly regarded...
Thanking you,
Prasad.
I am trying to share data between two simultaneously running programs. I am writing the output of one program to a file named xpos.out and reading the data in it from an other program which is running simultaneously. The value in xpos.out changes each time. So when i try to read this in the next cylce i never get the updated value.
I am following a simple procedure:
In one program iam writing it to xpos.out and immidiately closing it. and in another program iam reading the data in xpos.out. Only the first value is getting repeated.
Any help regarding this would be highly regarded...
Thanking you,
Prasad.
Well unless you are reading and writing at the same time, there shouldn't be any problem.
That is if it cycles like
Process A - Write File
Process A - Close File
Process B - Read File
Process B - Close File
Repeat from above
There are mechanisms by the operating systems for processes to communicate with eachother. One of the easiest way is to use a socket. Make a connection between the processes through a socket and then write the data to the socket. The recieving process can then read from the socket when there is data available.
That is if it cycles like
Process A - Write File
Process A - Close File
Process B - Read File
Process B - Close File
Repeat from above
There are mechanisms by the operating systems for processes to communicate with eachother. One of the easiest way is to use a socket. Make a connection between the processes through a socket and then write the data to the socket. The recieving process can then read from the socket when there is data available.
バルサミコ酢やっぱいらへんで
Have a look at this site. It is known as one of the best for introducing socket programming. Also it should work without any trouble in Linux with gcc.
Edit:
Both programs should be using the same port. One should be the server and the other should be the client.
Edit:
Both programs should be using the same port. One should be the server and the other should be the client.
バルサミコ酢やっぱいらへんで
![]() |
Similar Threads
- how to simultaneously run 2 programs by calling one from another (C)
- How to identify running programs (Windows 95 / 98 / Me)
- Massive Lag when running programs (Viruses, Spyware and other Nasties)
- Set Performance Options in Windows XP (Windows tips 'n' tweaks)
- System Running Programs (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: C++ HTTP post/get submitting and communication
- Next Thread: Reading CSV in VC++
| Thread Tools | Search this Thread |
api array arrays based binary bitmap c++ c/c++ calculator char char* class code coding compile console conversion count data database delete deploy desktop developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






