BOOL PathFindOnPath (LPTSTR pszFile, LPCTSTR * ppszOtherDirs);
I am calling this API from managed C ++. My pszFile is located in System.String.
What is the easiest way to pass this as LPTSTR? (Given its non-input parameter)
I tried pin_ptr and inner_ptr, but none of them were accepted by the compiler.
You need to marshal the (pre-allocated) StringBuilder instead of a String reference. For more information, see the MSDN Article at Marshaling .
, , . , , . , . , , , . :
#include <vcclr.h> ... String^ file = "blah.txt"; wchar_t path[_MAX_PATH]; { pin_ptr<const wchar_t> wch = PtrToStringChars(file); wcscpy_s(path, _MAX_PATH, wch); } BOOL ok = PathFindOnPath(path, something);
, , , .
Source: https://habr.com/ru/post/1751068/More articles:Display images on Android widgets using html & TextView - androidPython and rpy2: How to set up / clear image file at runtime? - pythonHow to make drops on mac osx using a machine? - applescriptHow to enable error detection for CSS files in Visual Studio 2010? - cssWhat is a good approach to implementing a markup tool for a paint program on an iPad? - iphoneIs it possible to have a UITabBarItem without an image, but with large text? - iphonememory leak prevention (depending on the specific case) - c ++JPanel does not generate MouseEvents when cursor is on child components - java"cannot find -lreadline error" when compiling Lua - linuxWeb Security at Rich Client - securityAll Articles