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

Send binary data to the standardInput of a process

P: n/a
I am writing a program in c#.

I would like to read a binary file to the standard input of a process (it is
flac.exe to encode/decode some files).

I have tried to use the following code :

StandardInputWriter = convertProcess.StandardInput;
[...]
byteRead = SourceFileStream.Read(buff,0,BUFFER_LENGTH);
StandardInputWriter.BaseStream.Write(buff,0,byteRe ad);

but it fails with somes files (whith custom chunk in the .wav input file).
However thhes files are well converted whne I use directly le flac.exe
command line. So it is the wrinting on the standard input which fails.

I think it is related to the fact that the standardInput is opened in text
mode (it uses a streamWriter)... is there an other way to write correctly
binay data to the standard input of a process ?

Thanks for your help

O_Spring
Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
hi,

did you tried StreamWriter.BaseStream?
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"O_Spring" <os*****@mailfrance.com> wrote in message
news:42***********************@news.free.fr...
I am writing a program in c#.

I would like to read a binary file to the standard input of a process (it
is
flac.exe to encode/decode some files).

I have tried to use the following code :

StandardInputWriter = convertProcess.StandardInput;
[...]
byteRead = SourceFileStream.Read(buff,0,BUFFER_LENGTH);
StandardInputWriter.BaseStream.Write(buff,0,byteRe ad);

but it fails with somes files (whith custom chunk in the .wav input file).
However thhes files are well converted whne I use directly le flac.exe
command line. So it is the wrinting on the standard input which fails.

I think it is related to the fact that the standardInput is opened in text
mode (it uses a streamWriter)... is there an other way to write correctly
binay data to the standard input of a process ?

Thanks for your help

O_Spring

Nov 17 '05 #2

P: n/a
Yes, I have... (StandardInput is a StreamWriter)

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> a
écrit dans le message de news: uL**************@TK2MSFTNGP10.phx.gbl...
hi,

did you tried StreamWriter.BaseStream?
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"O_Spring" <os*****@mailfrance.com> wrote in message
news:42***********************@news.free.fr...
I am writing a program in c#.

I would like to read a binary file to the standard input of a process (it is
flac.exe to encode/decode some files).

I have tried to use the following code :

StandardInputWriter = convertProcess.StandardInput;
[...]
byteRead = SourceFileStream.Read(buff,0,BUFFER_LENGTH);
StandardInputWriter.BaseStream.Write(buff,0,byteRe ad);

but it fails with somes files (whith custom chunk in the .wav input file). However thhes files are well converted whne I use directly le flac.exe
command line. So it is the wrinting on the standard input which fails.

I think it is related to the fact that the standardInput is opened in text mode (it uses a streamWriter)... is there an other way to write correctly binay data to the standard input of a process ?

Thanks for your help

O_Spring


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.