By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,684 Members | 1,338 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,684 IT Pros & Developers. It's quick & easy.

How to communicate to an executing C program from VB.NET

P: n/a
I am developing a VB application using Visual Studio.NET
and I need to communicate with a C program (supplying it
with inputs and receiving output from it). What is the
best way to do this?

Thanks in advance,
H. Lam
Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On 2003-10-10, hlam <hl**@cise.ufl.edu> wrote:
I am developing a VB application using Visual Studio.NET
and I need to communicate with a C program (supplying it
with inputs and receiving output from it). What is the
best way to do this?

Thanks in advance,
H. Lam


What kind of app is the C app? Is it a console application or is it a
typical Windows GUI?

If it is a console application, you can use the
System.Diagnostics.Process class to start the process and redirect the
stdin and stdout to you program.

Anyway, you need to supply more information...

--
Tom Shelton
MVP [Visual Basic]
Nov 20 '05 #2

P: n/a
* "hlam" <hl**@cise.ufl.edu> scripsit:
I am developing a VB application using Visual Studio.NET
and I need to communicate with a C program (supplying it
with inputs and receiving output from it). What is the
best way to do this?


Please provide more details about the C application. Do you have the
source code? Is it a console application or does it have windows?

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

P: n/a
It is a c app that we will be writing that can be executed
from a DOS prompt. We also want it to be an "engine" to
the VB app so the VB app can call it to pass it data and
get data in return.

Thanks in advance for your help.
H. Lam

-----Original Message-----
On 2003-10-10, hlam <hl**@cise.ufl.edu> wrote:
I am developing a VB application using Visual Studio.NET and I need to communicate with a C program (supplying it with inputs and receiving output from it). What is the
best way to do this?

Thanks in advance,
H. Lam
What kind of app is the C app? Is it a console

application or is it atypical Windows GUI?

If it is a console application, you can use the
System.Diagnostics.Process class to start the process and redirect thestdin and stdout to you program.

Anyway, you need to supply more information...

--
Tom Shelton
MVP [Visual Basic]
.

Nov 20 '05 #4

P: n/a
In article <0e****************************@phx.gbl>, hlam wrote:
It is a c app that we will be writing that can be executed
from a DOS prompt. We also want it to be an "engine" to
the VB app so the VB app can call it to pass it data and
get data in return.

Thanks in advance for your help.
H. Lam


Ahh, then it is a console application. Then you'll want to look at the
System.Diagnostics class. With that class you can start the application,
and redirect it's stdin and stdout to your own application... There is
a thread here were I already posted some example source of this. It is
discussing ReadConsoleOutput and ReadConsoleOutputChar. If you look for
those in the subject you'll find it :)

HTH

--
Tom Shelton
MVP [Visual Basic]
Nov 20 '05 #5

P: n/a
* "hlam" <hl**@cise.ufl.edu> scripsit:
It is a c app that we will be writing that can be executed
from a DOS prompt. We also want it to be an "engine" to
the VB app so the VB app can call it to pass it data and
get data in return.


Have a look at this sample:

<http://www.mvps.org/dotnet/dotnet/samples/miscsamples/downloads/RedirectConsole.zip>

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.