简体   繁体   中英

Input to console application in C#

I created a dll file for my matlab program. I integrated it into C# console application now I have to call this console application from php. The user selects an image whose imagepath should be passed as input in the C# console application.

I checked the console application my defining an image path and it works fine how can I program it to accept input from php aplication so that I can call exec(exepath imgpath)in php. I have to pass the image path to the matlab dll file too. My Console application is:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using shoesddl;
using MathWorks.MATLAB.NET.Arrays;
using MathWorks.MATLAB.NET.Utility;


namespace shoes_describe
{
    class Program
    {
        static void Main(string[] args)
        {
            shoesddl.shoes_describe obj = new shoesddl.shoes_describe();

            MWArray img= "C:/Users/adithi.a/Desktop/dressimages/T1k5aHXjNqXXc4MOI3_050416.jpg";
            obj.shoes(img);
        }
    }    
}

I need the imgpath ie img in the above program from php. How can I achieve it?

use Command Line Parameters . Your method is accepting parameters in string[] args . You can pass the image path alongwith the exe name, from your PHP code.

> exepath imgpath

That imagepath would available at args[0]

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