【问题标题】:Cannot redirect the output of an OCaml bytecode to a file in Windows server无法将 OCaml 字节码的输出重定向到 Windows 服务器中的文件
【发布时间】:2016-10-25 21:26:04
【问题描述】:

我编写了一个基本的 OCaml 文件 test.ml,并编译了我的 Windows 服务器。它在命令提示符下工作:

但是,如果我在 php 中运行它,只有最后一行(即testbat.bat)成功写入result.txt,而test.exe 总是失败:

exec('C:\\PRODSERVER\\OCamlTest\\test.exe >> C:/inetpub/testaddbbacom/test/result.txt');
exec('C:/PRODSERVER/OCamlTest/test.exe >> C:/inetpub/testaddbbacom/test/result.txt');
exec('C:\PRODSERVER\OCamlTest\test.exe >> C:/inetpub/testaddbbacom/test/result.txt');
exec("C:\\PRODSERVER\\OCamlTest\\test.exe >> C:/inetpub/testaddbbacom/test/result.txt");
exec('C:/PRODSERVER/OCamlTest/testbat.bat >> C:/inetpub/testaddbbacom/test/result.txt');

有人知道怎么解决吗?

【问题讨论】:

  • 我找到了解决办法:编译时添加-custom作为ocamlc的选项...我不会删除这个问题,可以作为记录...
  • 您可以为自己的问题提供答案,甚至接受它。如果答案有用,人们会感谢你:)

标签: php ocaml windows-server-2012-r2


【解决方案1】:

也许您可以尝试这里描述的解决方案:Batch-file get return Value from exe

可能是 exe 使用的输出类型存在问题。由于你的.txt文件的第一行,我认为程序在上面写成功了......带有一个空值。

【讨论】:

    【解决方案2】:

    我找到了解决方案:在编译时添加 -custom 作为 ocamlc 的选项...

    【讨论】:

      猜你喜欢
      • 2017-07-06
      • 2016-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-12
      • 2015-10-30
      相关资源
      最近更新 更多