Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Hi all I am new on server stuffs, correct me if I got any error underneath.

I had recently set up a linux server for user to upload their own file on it. User could access the server through a dedicated webpage, sign in, upload and restore any file on the server. The webpage contain simple html, css and php script.

Meanwhile I got a C program which can help to compress the size of files. The program is not a executable file yet, but a bunch of .c and .h file. I tried to MAKE all the file in Linux and implement the C program to the server, and wish to auto-compress the user uploaded file before it is stored in the server.

However I am not sure how to call the C program inside the webpage.... Appreciate for any advices and guidelines, thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
140 views
Welcome To Ask or Share your Answers For Others

1 Answer

If you using php then I would recommend shell_exec function,

shell_exec('gcc yourfile.c -o someobjectfile');

output=shell_exec('./someobjectfile');

echo "<pre>$output</pre>";

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...