Process StandardInput Limitations ?

R

[ripper]

Hello,
I'm building a software to interface with an .exe that will parse a
text file (a lex program build in cygwin that works great when it's
executed on it's own).

The OutputXML is more than 150 000 characters and the software always
bugs at the 20479 character, it just seems to hang and nothing happens.
If I try with 20 000 characters it works great.

Is there any size limitation ? If so is there anyway to get passed this
limitation ?

Thank you,

PS : Here is my code :

StreamWriter swx;
StreamReader srx;

p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;

p.StartInfo.FileName = "xmltest.exe";
p.Start();
swx = p.StandardInput;
srx = p.StandardOutput;

swx.AutoFlush = true;
char[] OutputChar = OutputXML.ToCharArray();

for (int i = 0; i < OutputChar.Length; i++)
{
swx.Write(OutputChar);
swx.Flush();
}
swx.WriteLine("");
swx.WriteLine("EOF");
 
V

Vadym Stetsyak

Hello, [ripper]!

r> The OutputXML is more than 150 000 characters and the software always
r> bugs at the 20479 character, it just seems to hang and nothing happens.
r> If I try with 20 000 characters it works great.

r> Is there any size limitation ? If so is there anyway to get passed this
r> limitation ?

how do you fill OutputXml?

StreamWriter supports writing strings,
you can write without loop

swx.Write(OutputXml);

You can test the code with your custom console application, that will call Console.Read(...);
and if it would accept more that 150K symbols then the bug may be in the application that reads from console.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
R

[ripper]

Thank you for your reply Vadym,
Actually I tried with the string first and tought it was too large
that's why I did it in an array.

The xmltest.exe program works great (with the same file) when I use
xmltest.exe < file.xml

Is there anyway to do this in c# ?


Vadym Stetsyak a écrit :
 
V

Vadym Stetsyak

Hello, [ripper]!

r> The xmltest.exe program works great (with the same file) when I use
r> xmltest.exe < file.xml

r> Is there anyway to do this in c# ?

Yes, you wrote it in the above message.
What kind of error do you receive?

If application hangs in writing to the stream, maybe this means that xmltest.exe is processing data?.
Have you access to the xmltext.exe sources. If you have to can debug xmltext.exe, and see how it is reading from the input stream...

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
R

[ripper]

Yes I have access to the xmltest.exe source, it's a simple lex program
compiled in C (actually it's only ment to echo the characters as a test
until i get it working)

Here is the source :
%{
%}
%%
"EOF"$ return 0;
.. ECHO;
%%
int main(void)
{
yylex();

return 0;
}


Vadym Stetsyak a écrit :
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top