-2

I have an application written in C. I have to develop a GUI for it. This application will be connected to the internet and will send and receive requests and responses through the network.

One way is to write the code in PHP to send and receive requests and responses by POST or something, and compile the C code into an executable, and then use PHP's shell_exec() function to run that exe. Is this good approach?

I am a beginner and I want to know what would be the best way to go about this kind of thing. Performance is definitely important, but modern look and feel of GUI is also very important.

Solace
  • 97
  • 1
  • Are you asking how to do GUI over network? – ctrl-alt-delor Apr 08 '17 at 21:14
  • What is the architecture you have so far? Are you going to be hosting this application on a web server (such as Apache or IIS), or is this on a small computer (Raspberry Pi) that you are going to be connecting to the network. Are you thinking about exposing the app's functionality as services? – Jay Elston Apr 13 '17 at 01:30

1 Answers1

2

You have added label, probably, this is the answer: just use GTK and you will get pure C app. As bonus you will be able to run your app on several platforms (of course: crossplatform is not painless).

The other option — QT library.

Embed C module

There is the other approach — use C module as core, and NodeJS or Python (Java/C#/...) for writing UI and other application-logic:

  • UI code in python/javascript/java/C#...
  • application logic (parse arguments, load DB, event-handling, signals..) implemented in python/js/java/C#
  • time-consuming things could be implemented in C and compiled as module for corresponding language (don't forget: a lot of things already implemented, and exist like packages on NPM and PyPI)

Probably, this approach should reduce development time, bcz native C application (entirely in C: UI+core+whistles) will take A LOT OF YOUR TIME. But if you are not familiar with other languages or you want to learn C ­— this is not for you.


One important thing for junior-coders: avoid to create your own scooter, when there are a lot of guru, who have created awesome bicycles already. At least look, which pitfalls they have avoided already;)

maxkoryukov
  • 183
  • 6
  • Thank you. I am also familiar with Java. I am way better at Java than I am at C actually. – Solace Apr 08 '17 at 19:39
  • And thank you especially for that advice in the end. I'll follow it, the only challenge is that beginners don't always know about the bicycles that exist, and which ones to choose among the ones that they know the names of.. – Solace Apr 08 '17 at 19:41
  • 1
    @Solace, thanks god, there is google)) it is doesn't matter how long you are in coding-industry, you will google and read **a lot of articles**, **A LOOOOT** – maxkoryukov Apr 08 '17 at 20:07
  • Hey can I do with PHP what you are suggesting to do with Java or Python etc. ? I mean I know I _can_ but would you suggest it? – Solace Apr 08 '17 at 20:07
  • 1
    All this years I tried to avoid PHP-coding, all possible ways. So today, I know: there is PHP, and guys write code on PHP. But also I know: there is a lot of mess in PHP, and you must be very accurate and rigorous to became a good PHP-coder. – maxkoryukov Apr 08 '17 at 20:11
  • 2
    Anyway: **PHP is for web**. This is its main purpose, even today. – maxkoryukov Apr 08 '17 at 20:12
  • I have done basic coding in PHP as well and it's not that bad in my experience. On a basic level, it is very similar to Java. Yes it is for the web. I described my need. Would you suggest a web application (PHP) or a desktop application (Java)? PHP would be easier for me because I don't have any experience with Java network programming and very little experience in Java GUI (using Swing) development. I have a bit of experience in both the things in PHP. :s I am confused. – Solace Apr 08 '17 at 21:19
  • @Solace if you want to write an app **fast** — use PHP! Don't doubt;) If you want to create another one awesome app — probably, you already know which technology suites better;) If you want to exercise in C/Java/C#/GoLang/any-other-lang ­— go forward;) The choice depends on your requirements and targets! And for us, a **very detailed description** of a desirable application is required to answer your question – maxkoryukov Apr 08 '17 at 21:32