Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Perl System()函数_C#_Perl - Fatal编程技术网

C# Perl System()函数

C# Perl System()函数,c#,perl,C#,Perl,我想知道perl system()函数的等效C#代码是什么,请参见下面的代码 $flac = `/usr/bin/which flac`; ($fh, $tmpname) = tempfile("stt_XXXXXX", DIR => "/tmp", UNLINK => 1); /// Some code for recording $endian = (unpack("h*", pack("s", 1)) =~ /01/) ? "big" : "little"; $sample

我想知道perl system()函数的等效C#代码是什么,请参见下面的代码

$flac = `/usr/bin/which flac`;
($fh, $tmpname) = tempfile("stt_XXXXXX", DIR => "/tmp", UNLINK => 1);

/// Some code for recording

$endian = (unpack("h*", pack("s", 1)) =~ /01/) ? "big" : "little";
$samplerate = 8000;
$format = sln;

if(system($flac, $comp_level, "--totally-silent", "--channels=1", "--endian=$endian", "--sign=signed", "--bps=16", "--force-raw-format", "--sample-rate=$samplerate", "$tmpname.$format") != 0)
{
   if (open($fh, "<", "$tmpname.flac")) 
   {
    $audio = do { local $/; <$fh> };
    close($fh);
   }
}
$flac=`/usr/bin/which flac`;
($fh,$tmpname)=临时文件(“stt_uxxxxxx”,DIR=>“/tmp”,UNLINK=>1);
///一些录音的代码
$endian=(解包(“h*”,打包(“s”,1))=~/01/)?“大”:“小”;
$samplerate=8000;
$format=sln;
如果(系统($flac、$comp_level、“--完全静音”、“--通道=1”、“--endian=$endian”、“--sign=signed”、“--bps=16”、“--force raw format”、“--sample rate=$samplerate”、“$tmpname.$format”)!=0)
{

if(open($fh),perl中的系统调用很可能使用给定字符串调用操作系统的命令行处理器

在C#中,您可以使用
System.Diagnostics.Process.Start
启动一个新流程。可以从以下示例开始