jjzjj

argument

全部标签

windows - 在 Win32 GUI 应用程序中使用标准输出 : crashes if I don't have a redirect to file in arguments

我正在构建一个Win32GUI应用程序。在该应用程序中,我使用了一个旨在用于命令行应用程序的DLL。假设Foo.exe是我的GUI应用程序,而bar()是DLL中的一个函数,它将“hello”打印到标准输出。Foo.exe调用bar()。如果我从命令行运行Foo.exe,重定向(>)(即Foo.exe>out.txt),它将“hello”写入out.txt并正常退出(如预期的那样)。但是,如果我运行Foo.exe而不重定向(从cmd.exe或通过在Windows资源管理器中双击),它会在调用bar()时崩溃。如果我在调试器中运行Foo.exe,在命令行中使用重定向(通过项目的VS属性设

python - cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'

我在windows10CMD中遇到了一个问题,当我尝试为coco数据集编译一个.py文件时,问题就出现了。信息如下:runningbuild_extbuilding'pycocotools._mask'extensionC:\ProgramFiles(x86)\MicrosoftVisualStudio14.0\VC\BIN\amd64\cl.exe/c/nologo/Ox/MD/W3/GS-/DNDEBUG-IE:\Anaconda2\Lib\site-packages\numpy\core\include-I../common-IE:\Anaconda2\include-IE:\A

c# - 如何指定属于一个类但不属于某个子类的对象?

classA{}classB:A{}voidmethod(AthatisnotaBargument){}voidgeneric_method(generic_classgeneric_argument){}voidparams_method(paramsAthatisnotaB[]params_arguments){}有什么语法上的方法可以做到这一点吗?我意识到我可以做到if(argumentisB)thrownewArgumentException("argumentcannotbeaB","argument");在第一个方法的开头,并在第二个和第三个的foreach中执行此操作,但

c# - PInvoke C# : Function takes pointer to function as argument

我想在我的C#代码中访问这个函数,这可能吗?所以最后C++代码会调用我的函数并应用名为“sFrameofData”的结构。C++代码://Theusersuppliedfunctionwillbecalledwheneveraframeofdataarrives.DLLintCortex_SetDataHandlerFunc(void(*MyFunction)(sFrameOfData*pFrameOfData));这也许行得通吗?C#代码:[DllImport("Cortex_SDK.dll")]publicexternstaticintCortex_SetDataHandlerFu

c# - 具有多个参数的函数的 Resharper 右括号缩进

我在C#中有一些代码行,Resharper缩进如下:Console.WriteLine("Hello");this.MySuperFunction(argument1,argument2,argument3);Console.WriteLine("World");由于我个人的编码风格,我希望上面的代码出现在没有任何缩进的右括号(或大括号)中,如下所示:Console.WriteLine("Hello");this.MySuperFunction(argument1,argument2,argument3);Console.WriteLine("World");我尝试使用Resharpe

c# - Rhino 模拟 - AssertWasCalled : How to improve unclear diagnostic message when incorrect arguments

恕我直言,RhinoMocks在使用AssertWasCalled时会产生一条不清楚的诊断消息,以验证是否已使用特定参数调用方法。例子:interfaceISomeInterface{voidWrite(strings);}[TestFixture]publicclassSomeTests{[Test]publicvoidWriteShouldBeCalledWithCorrectArguments(){//Arrangevarmock=MockRepository.GenerateMock();varsut=newSomeClass(mock);//Actsut.DoSomethin

c# - Image.FromStream() 方法返回 Invalid Argument 异常

我正在从智能相机成像器捕获图像,并通过套接字编程从相机接收字节数组(.NET应用程序是客户端,相机是服务器)。问题是我在运行时遇到System.InvalidArgument异常。privateImagebyteArrayToImage(byte[]byteArray){if(byteArray!=null){MemoryStreamms=newMemoryStream(byteArray);returnImage.FromStream(ms,false,false);/*lastargumentissupposedtoturnImagedatavalidationoff*/}retu

c# - Process.StartInfo.Arguments 是否支持 UTF-8 字符串?

可以使用UTF-8字符串作为StartInfo的参数吗?我正在尝试将UTF-8(在本例中为日语字符串)作为控制台参数传递给应用程序。类似这样的东西(这只是一个例子!(cmd.exe将是一个自定义应用程序))varprocess=newSystem.Diagnostics.Process();process.StartInfo.Arguments="/K\"echoこれはテストです\"";process.StartInfo.FileName="cmd.exe";process.StartInfo.UseShellExecute=true;process.Start();process.W

c# - The non-generic method cannot be used with type arguments in this context 是什么意思?

我有以下类和方法:publicclassUserManager:IDisposablewhereTUser:class,global::Microsoft.AspNet.Identity.IUserwhereTKey:global::System.IEquatable{publicvirtualTaskFindByIdAsync(TKeyuserId);和:privateApplicationUserManager_userManager;publicApplicationUserManagerUserManager{get{return_userManager??Request.Ge

C# 显示错误 'Delegate ' System.Func<...>' does not take 1 arguments

我打电话:form=newFormFor().Set(x=>x.Name,"hi");其中Project有一个名为Name的字段,FormFor的代码是:publicclassFormForwhereTEntity:class{FormCollectionform;publicFormFor(){form=newFormCollection();}publicFormForSet(Expression>property,stringvalue){form.Add(property.PropertyName(),value);returnthis;}}但它一直告诉我Delegate'Sy