我对铬19.0.1058.0(124615)有点问题.我一直在"新标签"标签的控制台中.然后我在控制台中编写了一个函数,然后输入"}"(使用alt-gr).它缩放了我的控制台.
我能做什么 ?
我的项目有问题.我想启动一个进程,7z.exe(控制台版).我尝试过三种不同的东西:
什么都行不通.它始终"等待"过程结束以显示我想要的内容.我没有任何代码可以放,只要你想要我的代码与其中一个列出的东西.谢谢.
编辑:我的代码:
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.CreateNoWindow = true;
process.Start();
this.sr = process.StandardOutput;
while (!sr.EndOfStream)
{
String s = sr.ReadLine();
if (s != "")
{
System.Console.WriteLine(DateTime.Now + " - " + s);
}
}
Run Code Online (Sandbox Code Playgroud)
要么
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.OutputDataReceived += new DataReceivedEventHandler(recieve);
process.StartInfo.CreateNoWindow = true;
process.Start();
process.BeginOutputReadLine();
process.WaitForExit();
public void recieve(object e, DataReceivedEventArgs outLine)
{
System.Console.WriteLine(DateTime.Now + " - " + outLine.Data);
}
Run Code Online (Sandbox Code Playgroud)
要么
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.Start(); …Run Code Online (Sandbox Code Playgroud) 我想在我班上使用winsock函数(而不是QTcpSocket或QUdpSocket).但是我的类继承了QObject,所以来自QObject的connect()与来自winsock2.h的connect()冲突.我怎么能绕过这个冲突,我正在搜索"Winsock2 :: connect()"或类似的东西,但我找不到.谢谢
我有一个很好的技术来获取当前系统中的相关扩展/图像(因为扩展可以有从系统到另一个系统的不同图像).这是功能:
public static Icon getIconFromFile(string ext, bool large = true)
{
string fileName = (new Random()).Next(100, 1000).ToString() + ext;
System.IO.File.Create(fileName);
System.Drawing.Icon icon;
SHFILEINFO shinfo = new SHFILEINFO();
if (large)
{
IntPtr hImgLarge = Win32.SHGetFileInfo(fileName, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), Win32.SHGFI_ICON | Win32.SHGFI_LARGEICON);
icon = System.Drawing.Icon.FromHandle(shinfo.hIcon);
}
else
{
IntPtr hImgSmall = Win32.SHGetFileInfo(fileName, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), Win32.SHGFI_ICON | Win32.SHGFI_SMALLICON);
icon = System.Drawing.Icon.FromHandle(shinfo.hIcon);
}
try
{
System.IO.File.Delete(fileName);
}
catch(Exception e)
{
System.Console.WriteLine(e.StackTrace);
}
return icon;
}
Run Code Online (Sandbox Code Playgroud)
问题是该函数没有关闭对文件的访问,所以我无法删除它.我能怎么做 ?谢谢
我想使用模板来指定函数中的大小.让我给你举个例子.我可以做这个:
int sub (int a[2][2]) {
}
int main () {
int a[2][2];
sub(a);
}
Run Code Online (Sandbox Code Playgroud)
我可以做这个:
template<int size2>
int sub (int a[][size2]) {
}
int main () {
int a[2][2];
sub(a);
}
Run Code Online (Sandbox Code Playgroud)
但我想要的是:
template<int size1, int size2>
int sub (int a[size1][size2]) {
}
int main () {
int a[2][2];
sub(a);
}
Run Code Online (Sandbox Code Playgroud)
我怎么能?