Sending data between Windows Applications

From Control Systems Technology Group
Jump to navigation Jump to search

This is a brief explanation of code used to send data between Windows applications using a simple text-file that is being written and read by the communicating programs.

This code is part of a project to create a robot technique that allows users to hug someone when separated by a disctance like a phone call.

We do realise that this is an ad hoc method and that there are better ways out there to do this, but it suffices for our prototype.

Writing to the text-file

Reading the text file

This part of the code belongs to the application responsible for sending ROS messages to a Ubuntu machine from a Windows machine. Additional information about this application's code can be found here.

Read file.png These lines are responsible for reading the data from the text-file with the absolute file path known to both applications. In this code, the absolute file path is "C:\\angles.txt" (line 49). It should be replaced by the absolute file path of the file the user would like both applications to use. in is an input stream intialized somewhere else in the code.