简体   繁体   中英

Running a CPP file in a C# application?

I am currently on a project where I need to take a video file name from a UI built with C#. After that, I need to pass the file name to my C++ application where the image processing algorithms will be done. After having the results from image processing algorithms, I need to pass the data to C# UI and print them on the screen. To summarize, the workflow will be like this:

1)Get filename from user(In .cs file)

2)Pass filename to CPP(In .cs file)

3)Get the filename(In .cpp file)

4)Do the image processing algorithms(In .cpp file)

5)Pass the video data to .cs(In.cpp file)

6)Get data from .cpp(In .cs file)

7)Print data(In .cs file)

I am not sure if this is doable, so if not, I'm open for any different ideas. Thanks.

Call the C++ function from C# via PInvoke. You should read up on Pinvoke.

You could use the Process class in C# to run a C++ compiler on the .cpp file, execute the compiled C++ program, and then read in the output of the C++ program. How to read the output of the C++ program depends on how the C++ program outputs the data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM