Reputation: 31
I have a problem with two projects. My main project is in C++. Another one is in C# and it is measuring current network bandwidth (updated every second). What I need to have is that C++ project can get those values.
Mt first thought was to let the C# export calculated values to .txt file. Another project could read those values. But problem is that it would mean that both would use that file at the same moment what seems to be impossible (or maybe I could synchronize it somehow?)
I was reading a lot about creating and using library, but it looks complicated to me.
Are there any other ways to do that?
Please, I need help...
Upvotes: 1
Views: 143
Reputation: 2882
As well as the other options outlined by the others, you also have the option of making the functionality of your c# code into a DLL and then calling that from your C++ code to allow you to use the functionality of the DLL to get network information. I have a how-to type link here on how to create a C# DLL. You can then reference said DLL in C++ and utilise its functionality as needed.
Hope this helps, and let me know if you need any further information:)
Upvotes: 1
Reputation: 6955
The simplest way is using stdin / stdout for this purpose. Just write the values to Console
from the C# program and read it from pipe in the C++ program.
Or maybe you'd like to extend your project to C++/CLI (.NET-based C++ extension) and directly reference your C# library.
Upvotes: 1