I Have the following in my own library project and I call it from my C#
application twice each time to get Unix group account information and user
account information. But it would return different number of records (lines
of data read), sometimes 0 records without any of my message, and there
doesn't seem to be a pattern to be found. Can someone have a look and see if
any of my code could possbly cause this? Thanks.
static System.Text.Str ingBuilder sb = new System.Text.Str ingBuilder();
static void proc_OutputData Received(object sender,
DataReceivedEve ntArgs e)
{
if(sb.Length 0)
sb.Append("\n") ;
sb.Append(e.Dat a);
}
public static int GetNisFile(stri ng parm, ref DataTable dtAccounts,
ref ToolStripStatus Label slMain, ref StatusStrip ssMain, string
userOrGroup)
{
string accountFile = "", error="";
int numOfAccounts = 0;
System.Diagnost ics.Process listFiles = new Process();
sb.Remove(0, sb.Length);
try
{
listFiles.Outpu tDataReceived += new
DataReceivedEve ntHandler(proc_ OutputDataRecei ved);
listFiles.Start Info = new
ProcessStartInf o(Application.S tartupPath +
"\\ypcat.ex e", parm);
listFiles.Start Info.WindowStyl e = ProcessWindowSt yle.Hidden;
listFiles.Start Info.UseShellEx ecute = false;
listFiles.Start Info.RedirectSt andardOutput = true;
listFiles.Start Info.RedirectSt andardError = true;
listFiles.Start Info.CreateNoWi ndow = true;
if (listFiles.Star t())
{
listFiles.Begin OutputReadLine( );
listFiles.WaitF orExit(30000);
if (listFiles.HasE xited)
{
error = listFiles.Stand ardError.ReadTo End();
if (error == "")
{
accountFile = sb.ToString();
if (accountFile != null && accountFile != "")
numOfAccounts =
CPAUnix.ParseAn dInsertAccounts (accountFile,
ref dtAccounts, ref slMain, ref ssMain,
userOrGroup);
}
else
MessageBox.Show (error, "PowerADvantage ");
}
else
MessageBox.Show ("Time out retrieving NIS " +
userOrGroup + " accounts.",
"PowerADvantage ");
}
else
MessageBox.Show ("Error starting process to read file.",
"PowerADvantage ");
if (listFiles != null)
{
listFiles.Cance lOutputRead();
listFiles.Close ();
}
return numOfAccounts;
}
catch (Win32Exception wex)
{
MessageBox.Show (wex.Message, "PowerADvantage ");
return numOfAccounts;
}
}
--
Thanks. 0 1295 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Peter Åstrand |
last post by:
There's a new PEP available:
PEP 324: popen5 - New POSIX process module
A copy is included below. Comments are appreciated.
----
PEP: 324
Title: popen5 - New POSIX process module
|
by: Guy |
last post by:
Hi, I created a function, which seems to work, quite well, it tells me
if a process is running in widows using the pid number (I'm aware that
the pid number in widows is not called a pid and this is really a unix
thing but what the hell). The function keeps crashing (I've included
the crash but I don't think it will do any good.), only sometimes,
most of the time it works fine and I don't know why, Could any body
suggest anything, maybe...
|
by: Michael Trosen |
last post by:
Hi Everyone,
I hope someone can help, I'm pretty new to pro*c programming.
I have the following application setup:
a pro*c program calls a stored procedure and recieves a cursor back:
the cursor is defined as: SQL_CURSOR delpt_cursor
|
by: MN |
last post by:
Hello all -
I'm hoping someone will be able to share their knowledge with me about this
issue I'm having because I have run out of answers. Here's the scenario....
I have a .aspx page that basically makes a call to a WSDL which returns a
RedirectURL that I need to navigate to to verify if I'm authorized to proceed
into an application. The moment I redirect to that login page and attempt to
login, it is detecting my original...
|
by: Peter McEvoy |
last post by:
Folks,
I've been building a Webservice API for a contract that will be exposed to
the internet at large. There are two endpoints, and each endpoint contains a
number of webmethods. Every webmethod returns a returncode which indicates
the level of success in performing the operation (as well as the actual
results of the call in an "out" parameter)
They have a requirement that when they want to perform maintenance on the
backend system,...
| |
by: leo |
last post by:
babelfish provides online translation service
if clicking one of my links containing:
http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=en_ja&trurl=http://mypage.show.php
all the following pages will contain the http://babelfish.altavista.com
i wonder if PHP is able to retrieve the translation result.
Thanks for your help.
|
by: =?Utf-8?B?Q3JhaWc=?= |
last post by:
Hi Guys,
I am trying to caputre the output for an external application. The idea is
to use the System.Diagnostics.Process to run the exe in a process and
redirect the output to a string.
When I run the external command it works fine. But when i wrap it in a .net
exe it fails to exit and the application does not exit. If I kill the
external exe from task manager, the .net wrap completes.
|
by: Bhavin |
last post by:
HI,
I have to implement a program using exec command to illustrate
concurrent and sequential process. What I did is just create two input
file
Alpha.txt
========
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
|
by: gnawz |
last post by:
Hi guys,
I have a couple of php files that perform various tasks.
I will use fields in my system and provide code as well
I need help as follows:
My database contains the fields Category and Brand
I need to make some changes on a a number of brands in a Category
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |