473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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

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
5 1211
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
* "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
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
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
* "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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Edward C. Jones | last post by:
I have a program named "octave" (a Matlab clone). It runs in a terminal, types a prompt and waits for the user to type something. If I try # Run octave. oct = subprocess.Popen("octave",...
8
by: Joakim Persson | last post by:
Hello all. I am involved in a project where we have a desire to improve our software testing tools, and I'm in charge of looking for solutions regarding the logging of our software (originating...
3
by: Jay Patel | last post by:
Hello, I need to write visual basic.net code to interface with a Mettler Toledo Shipping Scale that interfaces with a PC via USB or a serial port. I have seen example code on how to communicate...
0
by: BasicQ | last post by:
I am running an executable from my aspx page with the click of a button. A date is passed as an argument. I am able to get the standardoutput from the Process(Exe) into the label of my page after...
7
by: tshad | last post by:
I thought I understood how the SaveViewState is working and was trying to use this (as per some code I found) to detect refreshes. It seemed to be working but I found that the SaveViewState was...
8
by: lovecreatesbea... | last post by:
K&R 2, sec 2.4 says: If the variable in question is not automatic, the initialization is done once only, conceptually before the program starts executing, ... . "Non-automatic variables are...
9
by: tsung-yu | last post by:
Hello any expert, I has a vb.net program. For user requirement, I need to run and communicate an old DOS execution file. But, how to run and communicate a DOS program in a VB.NET program?...
6
by: Mike9900 | last post by:
How can I connect my .NET app which use remoting to communicate over internet, 2 instance of the same app? My app is already done using .NET Remoting. I am wondering if to change them to WCF or...
0
by: Ajith | last post by:
Hi All, I am implementing a TCP/IP Socket programming using POSIX Standard. I have my server up and running. one of the client which needs to communicate with server - has been implemented using...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.