Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Reading files using C++

Options
  • 12-01-2005 7:49pm
    #1
    Registered Users Posts: 976 ✭✭✭


    Hi all,
    For my project, I need to send robot direction instructions from a mobile phone firslty to the server computer and then onto a robot via a radio packet controller link.
    Currently, I've made the GPRS connection with the server computer and I am writing the Robot direction Instructions, A for Forward, B for Right etc into a file on the C drive using java.
    Does anyone have any ideas how I can instantly read this file using a C++ program to send them to the robot via an RPC interfaced to the computer via the NI-DAQ card. I need to use C++ as it controls the NI-DAQ card.
    Can I write to a file using java and at the same time keep reading the file using C++. I presume I'd need to delete the contents of the file after each robot direction instruction is sent.
    Can anyone please offer any advice on this or maybe suggest a better way of overcoming the situtation
    Thanks and Regards
    Glenman


Comments

  • Registered Users Posts: 1,481 ✭✭✭satchmo


    It sounds like you'd be better off with some a socket connection between the two, it would be a much easier way of them communicating. Can you change the java program that's writing to the C drive and make it write to an open port instead? Networking's easy in java, it shouldn't be much trouble if you have the source code. Then you can write to 127.0.0.1:9999, and with the C++ program open a socket on that port to read the commands. It would be easier to read & write messages this way than writing to & clearing a file.

    An even better way of doing it would be using the Java Native Interface to let the two programs communicate directly with each other, but I don't know much about that - I'm sure someone here can fill you in. Above is how I'd do it.


Advertisement