Kaan Demirel
Kaan Demirel

Reputation: 180

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.

Upvotes: 0

Views: 1134

Answers (2)

Incerteza
Incerteza

Reputation: 34884

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

Upvotes: 2

LVBen
LVBen

Reputation: 2061

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.

Upvotes: 1

Related Questions