How do I use Gnuplot in C.

Gnuplot from C / C ++ (using a written .gpl)

After an extensive Google search, I have come across many interesting threads, but not yet what I have in mind. Hence my question:

I have a program which (after intensive calculations) outputs very large 2-column (actually 10 columns, but only wants to plot 2) .dat files that have already been adapted to gnuplot. The files are located in a subfolder of the main program called: subfolder.
So far I have always called "gnuplot" in this subfolder and created my images by hand from the data records via .gpl (command-list).
But now I want the following:
When my program has finished calculating the data sets (i.e. several .dat files), it should automatically call gnuplot (it is essential that it calls this program for the subdirectory so that I can use my .gpl) and both my " Execute plot.gpl "as well as my" png.gpl "so that a picture can be seen on the desktop, but at the same time it is saved again in the" subfolder ".
Does anyone have an idea?
I've already read a lot, but what I don't want is: Give my data directly to gnuplot. I need the calculated files for other things, so I'm looking for the option described above.

MFG Renscher

PS: Thanks for the lard used! :)