Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/292.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/149.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#转换为C++; 有人知道我怎样把这个(从C)转换成C++吗?_C#_C++_Code Conversion_Native Code - Fatal编程技术网

将确定性路径代码从C#转换为C++; 有人知道我怎样把这个(从C)转换成C++吗?

将确定性路径代码从C#转换为C++; 有人知道我怎样把这个(从C)转换成C++吗?,c#,c++,code-conversion,native-code,C#,C++,Code Conversion,Native Code,谢谢 编辑:附加信息 这是从C→→本机C++的转换。如果有其他方法获取当前正在执行的可执行文件的文件路径,我愿意接受这些想法。谢谢。 如果使用Visual C++ +/LI>,可以在C++中使用 来自上述链接的Assembly.GetAssembly示例 Assembly^ SampleAssembly; // Instantiate a target object. Int32 Integer1(0); Type^ Type1; // Set the Type instance to

谢谢

编辑:附加信息

这是从C→→本机C++的转换。如果有其他方法获取当前正在执行的可执行文件的文件路径,我愿意接受这些想法。谢谢。

  • 如果使用Visual C++ +/LI>,可以在C++中使用
来自上述链接的Assembly.GetAssembly示例

Assembly^ SampleAssembly;
// Instantiate a target object.
Int32 Integer1(0);
Type^ Type1;
// Set the Type instance to the target class type.
Type1 = Integer1.GetType();
// Instantiate an Assembly class to the assembly housing the Integer type.  
SampleAssembly = Assembly::GetAssembly( Integer1.GetType() );
// Gets the location of the assembly using file: protocol.
Console::WriteLine( "CodeBase= {0}", SampleAssembly->CodeBase );

如果您结合以上内容,您可能会更接近您想要做的事情<强>如果在本机C++中完成这一点,则会有更多的问题,有一些东西可以帮助您查找GAC中的程序集。

检索当前可执行文件的路径,使用null HMListar参数。< /P>您有哪些问题?你是从C语言转换为管理C++吗?或者你是想转换为本地C++ + Visual C++?还是标准C++?这是针对本机C++的。我需要得到可执行文件的位置。谢谢,菲利普。我已经在我的原始帖子中添加了一些额外的细节。@Jim,检查我的第二点“获取当前目录的路径”,即
GetCurrentDir
,这应该是您要查找的内容。谢谢。Microsoft现在调用函数
GetCurrentDirectory
Assembly^ SampleAssembly;
// Instantiate a target object.
Int32 Integer1(0);
Type^ Type1;
// Set the Type instance to the target class type.
Type1 = Integer1.GetType();
// Instantiate an Assembly class to the assembly housing the Integer type.  
SampleAssembly = Assembly::GetAssembly( Integer1.GetType() );
// Gets the location of the assembly using file: protocol.
Console::WriteLine( "CodeBase= {0}", SampleAssembly->CodeBase );