Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] Writing data to C execution file from QT Gui program

[Solved] Writing data to C execution file from QT Gui program

Scheduled Pinned Locked Moved General and Desktop
15 Posts 6 Posters 4.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Swinetha
    wrote on last edited by
    #1

    hai,

    In my application I want to send data from gui running program to C.exe file

    I tried like In c file I write a program to taking the I/p from scanf() and In Qt I call QProcess function. but it is giving the output as
    "The program has unexpectedly finished."

    Is my thought was wrong?
    If any solution is there then please explain me

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      The C.exe program has crashed when run. Nothing we can help you with there.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Swinetha
        wrote on last edited by
        #3

        I solved that error. But how can we send data to c program from Gui.

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          With console input, or using DBus, sockets, or just by setting the command line arguments (that's enough in some cases).

          (Z(:^

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Swinetha
            wrote on last edited by
            #5

            Is it possible with files?

            Means from GUI we write data to the one file & same file is reading from c program?

            1 Reply Last reply
            0
            • JeroentjehomeJ Offline
              JeroentjehomeJ Offline
              Jeroentjehome
              wrote on last edited by
              #6

              Using file is an option, but I wouldn't recommend it. Writing with one program and reading with the other might cause buffer overflows etc in your program. If there is data to be "transported" it might be a better option to use TCPIP connection to the home server. In Qt it is easy to setup and with signal/slots connections fast handling is achieved.

              Greetz, Jeroen

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Swinetha
                wrote on last edited by
                #7

                I am not getting buffer overflow using files but I am not getting present data. previous data only getting.

                How can I setup tha TCPIP in Qt is there any site for this?
                If it is,please provide me

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  If you're one the same machine, you can have a look at "QLocalServer":http://qt-project.org/doc/qt-4.8/qlocalserver.html and "QLocalSocket":http://qt-project.org/doc/qt-4.8/qlocalsocket.html

                  And if you really want TCP/IP you have QTcpServer and QTcpSocket. Have a look at the examples provided along these classes, that will help you get started.

                  There is also QSharedMemory. Read all their docs to find what's the best solution for you.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    Swinetha
                    wrote on last edited by
                    #9

                    C program and Qt both are on same machine only.
                    I have some doubt regarding using the server and socket programming in both C and QT,

                    My c program will called by QT only and C program will run with QT in background, So can I use server and socket program or not?

                    If I use shared memory concept in QT then how can I get that data from shared memory in to C program?

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      You're not locked with Qt's IPC classes, you can use pure C IPC even with your Qt program.

                      By the way it's Qt, QT is for Apple's QuickTime :)

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        Swinetha
                        wrote on last edited by
                        #11

                        Which is best one Socket programming or Shared memory , to Send continuous data to C program from QT?

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          sdel53
                          wrote on last edited by
                          #12

                          Is it possible with files?
                          Means from GUI we write data to the one file & same file is reading from c program?

                          adele

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            Swinetha
                            wrote on last edited by
                            #13

                            no. if we send the data from GUI to one file is OK but at a time reading same file from C program is not getting. It is reads only previous data it can not read present sending data

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @Swinetha, you'll have to do some testing to see what suits your needs best

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • S Offline
                                S Offline
                                Swinetha
                                wrote on last edited by
                                #15

                                Sorry for the late replay, Now I can send the data using arguments. If it's needed in my project then I will use Socket programming or shared memory Thank you for giving the replies

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved