dtebrq0245 2013-12-10 12:48
浏览 43

C ++显示输出到php

I have a C++ console application that returns some kind of things, then, I need to show that in a browser. So I tried to write every console.write from C++ to a .txt file for future PHP reading, but no success because it doesn't write the errors!

Then I tried to use exec('program.exe', $output); at PHP but no success too.. :/

  • Is there another way to do that?
  • Or any function in C++ that writes to a .txt every single thing that shows up in the console?
  • Or some function in another Programming Language that catches everything in the console?
  • 写回答

2条回答 默认 最新

  • dtz8044 2013-12-10 13:08
    关注

    There are three standard file handles known as stdin, stdout, stderr. Looks like you're only fetching stdout right now. Try to redirect stderr to stdout.

    exec('program.exe 2>&1', $output);
    

    (works not only on *nix but also win32).

    see also: In the shell, what does " 2>&1 " mean?

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作