asp.net(C#)调用C++程序并交互操作 关于“asp.net(C#)调用C++程序并交互操作 ”的问题,请推荐相关的书籍(最好带有PDF或word版下载地址)以及相关的网页链接或文章链接等。 非常感谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://edu.codepub.com/2010/0607/23334.php 这个太简单了,试验过了,在屏幕上闪过一下doc窗口 ,有没有更深入的介绍? 有一种说法是首先编写响应程序的动态链接库,然后再c++程序和.net之间架设一个中间层webservice用作通信 这样就可以了,谁有相关方面的资料? 我学的时候没有找到,都是从MSDN上学的。 你是从MSDN上学到的吗? 学的.Net调用c++COM? 我这里现有的C++程序使用vc MFC写的,能简单说说吗? 考虑到将来有可能需要用C#调用C++的程序,先实验一下。先准备下C++程序:考虑到将来有可能需要用C#调用C++的程序,先实验一下。先准备下C++程序:#include <stdio.h>#include <iostream>int main(){ printf("hi"); int v1,v2; std::cin>>v1; v2=v1*2; std::cout<<v2<<std::endl;}用C#调用:大气象 using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Diagnostics;public partial class _Default : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { Bind(); } private void Bind() { Process p = new Process(); p.StartInfo.FileName = @"F:\code\cpp\FirstCmd\debug\FirstCmd.exe"; //p.StartInfo.Arguments = ""; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.CreateNoWindow = false; p.Start(); // p.StandardInput.WriteLine("2"); string output = p.StandardOutput.ReadToEnd(); Response.Write(output); //if (p.HasExited) // p.Kill(); }} 本篇文章来源于:开发学院 http://edu.codepub.com 原文链接:http://edu.codepub.com/2010/0607/23334.php 求救 (在线等)错误:未能加载文件或程序集“FreeTextBox”或它的某一个依赖项。系统找不到指定的文件 .NET 母板的路径问题 关于在asp.net里使用sln文件问题 關于CultureInfo類 怎样将数据库中的数据保存到客户端的word文档中? 怎样删除DataGrid中的一行或多行。用DeleteCommand事件怎样写? 南京的朋友请近来一下(刚找到工作散分) 一个比较菜的问题,但是急等!有关数据适配器调用存储过程的东东! 请高手提供一个 "验收报告申请" 的样本 Request.Form[""] 取不到值。可是有值 啊。为什么 调试与发布后效果不一致
先准备下C++程序:
考虑到将来有可能需要用C#调用C++的程序,先实验一下。
先准备下C++程序:#include <stdio.h>
#include <iostream>
int main()
{
printf("hi");
int v1,v2;
std::cin>>v1;
v2=v1*2;
std::cout<<v2<<std::endl;
}
用C#调用:大气象
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;using System.Diagnostics;public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Bind();
}
private void Bind()
{
Process p = new Process();
p.StartInfo.FileName = @"F:\code\cpp\FirstCmd\debug\FirstCmd.exe";
//p.StartInfo.Arguments = "";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.CreateNoWindow = false;
p.Start();
//
p.StandardInput.WriteLine("2");
string output = p.StandardOutput.ReadToEnd();
Response.Write(output);
//if (p.HasExited)
// p.Kill();
}
}
本篇文章来源于:开发学院 http://edu.codepub.com 原文链接:http://edu.codepub.com/2010/0607/23334.php