I get the error "Not implemented".
I want to compress a file using 7-Zip via stdin then take the data via stdout and do more conversions with my application. In the man page it shows this example:
% echo foo | 7z a dummy -tgzip -si -so > /dev/null
I am using Windows and C#.
Results:
7-Zip 4.65 Copyright (c) 1999-2009 Igor Pavlov 2009-02-03
Creating archive StdOut
System error:
Not implemented
Code:
public static byte[] a7zipBuf(byte[] b)
{
string line;
var p = new Process();
line = string.Format("a dummy -t7z -si -so ");
p.StartInfo.Arguments = line;
p.StartInfo.FileName = @"C:\Program Files\7-Zip\7z.exe";
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardInput = true;
p.Start();
p.StandardInput.BaseStream.Write(b, 0, b.Length);
p.StandardInput.Close();
Console.Write(p.StandardError.ReadToEnd());
//Console.Write(p.StandardOutput.ReadToEnd());
return p.StandardOutput.BaseStream.ReadFully();
}
Is there another simple way to read the file into memory?
Right now I can 1) write to a temporary file and read (easy and can copy/paste some code) 2) use a file pipe (medium? I have never done it) 3) Something else.