473,323 Members | 1,570 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,323 software developers and data experts.

Please help in converting small section of C++ program in C# progr

// this is the code for calling fortran executable
PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo = { 0 };
memset((LPVOID)&StartupInfo,0,sizeof(STARTUPINFO)) ;
StartupInfo.cb = sizeof(STARTUPINFO);
if (CreateProcess ( NULL, "main.exe", NULL, NULL, FALSE,
0, NULL, NULL, &StartupInfo, &ProcessInfo) )
{
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);

}
else
{
}
// executable calling code end

Oct 7 '07 #1
2 1207
Sohan,

You will want to take a look at the Process class in the
System.Diagnostics namespace, as well as the ProcessStartInfo class.
Finally, you want to call the WaitForExit method to wait for the process to
complete.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"SohanC" <So****@discussions.microsoft.comwrote in message
news:12**********************************@microsof t.com...
// this is the code for calling fortran executable
PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo = { 0 };
memset((LPVOID)&StartupInfo,0,sizeof(STARTUPINFO)) ;
StartupInfo.cb = sizeof(STARTUPINFO);
if (CreateProcess ( NULL, "main.exe", NULL, NULL, FALSE,
0, NULL, NULL, &StartupInfo, &ProcessInfo) )
{
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);

}
else
{
}
// executable calling code end
Oct 7 '07 #2
Nicholas,

Thank you for your answer. Actually I have not written a C# program in a
last little while. Will it be possible for you to write few lines of code
that accomplishes the same thing as my C++ program does?

Actually, I am mostly a Fortran programmer but rarely I am expected to do
some C++ (now it will be C#) programming to accomplish some mix language task.

So****@aim.com

"Nicholas Paldino [.NET/C# MVP]" wrote:
Sohan,

You will want to take a look at the Process class in the
System.Diagnostics namespace, as well as the ProcessStartInfo class.
Finally, you want to call the WaitForExit method to wait for the process to
complete.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"SohanC" <So****@discussions.microsoft.comwrote in message
news:12**********************************@microsof t.com...
// this is the code for calling fortran executable
PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo = { 0 };
memset((LPVOID)&StartupInfo,0,sizeof(STARTUPINFO)) ;
StartupInfo.cb = sizeof(STARTUPINFO);
if (CreateProcess ( NULL, "main.exe", NULL, NULL, FALSE,
0, NULL, NULL, &StartupInfo, &ProcessInfo) )
{
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);

}
else
{
}
// executable calling code end
Oct 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Az Tech | last post by:
Hi people, (Sorry for the somewhat long post). I request some of the people on this group who have good experience using object-orientation in the field, to please give some good ideas for...
4
by: Clark Stevens | last post by:
I have a program that I'm converting from VB6 to VB.NET. It reads in a text file containing barcode numbers and their corresponding descriptions. Then the user enters the barcode number and the...
9
by: Michael Tissington | last post by:
After converting from 6.0 to 2005 when I try to Compile my project I'm getting a LINK error Error 1 fatal error LNK1181: cannot open input file " ?/.obj" Any ideas how to fx this please ? ...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
5
by: Testguy | last post by:
Hi, I was wondering if one the smart people that frequent this group could give me a hand with a small program I am attempting to debug. I am not a highly experienced developer, but can...
1
by: bobmct | last post by:
Again: struggling to convert old-style HTML to html using css. I am trying to create a rectangular box divided into approx three vertical sections. The top section contains an image I would like...
25
by: Blasting Cap | last post by:
I keep getting errors that pop up when I am trying to convert an application from dotnet framework 1.1 to framework 2.0. The old project was saved in sourcesafe from Visual Studio 2003, and I have...
4
by: Tonio Tanzi | last post by:
I have the following problem in a Win 2000 Server + SQL Server 2000 environment and I hope somewhat can help me to resolve it (after many days of useless attempts I am desperate). In my database...
2
by: blogman | last post by:
I am getting a Visual studio 2008 IDE application R6034 runtime error. This means that the IDE application is raising the error not the application I am building. This means that Microsoft did not...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.