为什么"1.bat"无法成功运行?任何帮助将不胜感激."1.bat"已成功创建.它可以无错误地运行,但无法重命名文件.
private void button1_Click(object sender, EventArgs e)
{
string str = System.Environment.CurrentDirectory;
str += "\\1.bat";
string txt = "";
txt = "ren *.mp3 *.wav";
StreamWriter sw = new StreamWriter(str,false, Encoding.UTF8);
sw.Write(txt);
sw.Close();
Process p = new Process();
p.StartInfo.FileName = str;
p.StartInfo.Arguments = "";
p.StartInfo.UseShellExecute = false;
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
p.Start();
}
Run Code Online (Sandbox Code Playgroud) 我尝试了两种方法将我的char*类型转换ss
为双精度类型。这是我的代码(在VC++6.0 windows64位编译)
int main()
{
char *ss = "-1964734.544";
cout<<ss<<endl;
cout<<*reinterpret_cast<double*>(ss)<<endl;
cout<<*(double *)ss<<endl;
}
Run Code Online (Sandbox Code Playgroud)
结果是:
-1964734.544
3.06123e-057
3.06123e-057
Run Code Online (Sandbox Code Playgroud)
我不清楚出了什么问题以及如何将 a 转换char*为 double 。