Results 1 to 7 of 7

Thread: QProcess not communicating with .net framework > 3.5

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2015
    Posts
    4
    Qt products
    Qt5
    Platforms
    Windows

    Question QProcess not communicating with .net framework > 3.5

    Hi all,

    I have a main Qt application, launching a C# app with QProcess.
    I would like to communicate with the C# app using the QProcess tools, the standard channels.
    Although the communication is working perfectly when I compile the C# app with .net framework 3.5, I am not receiving any data from the process when it is compiled with .net 4.0 or 4.5

    I posted a thread on the msdn forums : https://social.msdn.microsoft.com/Fo...=csharpgeneral

    I have made a minimal console example to replicate the issue:
    Qt Code:
    1. #include <QCoreApplication>
    2. #include <QProcess>
    3. #include <iostream>
    4. #include <string>
    5. using namespace std;
    6.  
    7. int main(int argc, char *argv[])
    8. {
    9. QCoreApplication a(argc, argv);
    10.  
    11. // Path to the C# executable
    12. QString program = "D:/Documents/ConsoleApplication1/ConsoleApplication1/bin/Release/ConsoleApplication1.exe";
    13.  
    14. // Start child Process
    15. QProcess * process = new QProcess();
    16. process->setProgram(program);
    17. // Execute lambda function whenever a message from the process is received
    18. QObject::connect(process, &QProcess::readyReadStandardOutput, [&](){ cout << process->readAll().toStdString(); } );
    19. process->start();
    20.  
    21. string text;
    22. cin >> text;
    23. process->write( QByteArray::fromStdString(text) + "\r\n" );
    24.  
    25. return a.exec();
    26. }
    To copy to clipboard, switch view to plain text mode 

    and a minimal C# example :
    Qt Code:
    1. namespace ConsoleApplication1
    2. {
    3. class Program
    4. {
    5. static void Main(string[] args)
    6. {
    7. string text;
    8. while (true)
    9. {
    10. Console.WriteLine("0");
    11. text = Console.ReadLine();
    12. Console.WriteLine("1");
    13. Console.WriteLine(text);
    14. }
    15. }
    16. }
    17. }
    To copy to clipboard, switch view to plain text mode 

    I am using Qt 5.4.1 on windows 7, and compiling with msvc 2010 32 bits.

    Thanks in advance for your help
    Last edited by SimpleIsBetter; 30th April 2015 at 21:09.

Similar Threads

  1. Communicating with a USB device in Qt?
    By N3wb in forum Qt Programming
    Replies: 7
    Last Post: 3rd May 2011, 10:30
  2. webpage communicating to a qt apps
    By ezesolares in forum Qt Programming
    Replies: 0
    Last Post: 23rd February 2011, 16:56
  3. Replies: 1
    Last Post: 4th March 2010, 20:47
  4. Qt communicating with USB device
    By jimmydean101 in forum Newbie
    Replies: 6
    Last Post: 2nd March 2010, 17:02
  5. communicating between threads
    By freekill in forum Newbie
    Replies: 2
    Last Post: 27th November 2009, 08:13

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.