Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [DllImport("essentials.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
- public static extern System.IntPtr GetFiles(string filedir, string path);
- [STAThread]
- static void Main()
- {
- string filedir = @"C:UsersRubenDocumentsSchool*";
- string path = @"C:UsersRubenDocumentsSchool";
- System.IntPtr pointer = GetFiles(filedir, path);
- string files = Marshal.PtrToStringAnsi(pointer); // nothing
- }
- extern "C"
- {
- __declspec(dllexport) char* GetFiles(char* filedir, char* path)
- {
- string filedir2 = filedir;
- string path2 = path;
- string files = GetFiles2(filedir2, path2);
- char* Rfiles = new char[files.length() + 1];
- strcpy_s(Rfiles, files.length() + 1, files.c_str());
- return Rfiles;
- }
- }
- [DllImport("essentials.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
- public static extern System.IntPtr GetFiles
- ([MarshalAs(UnmanagedType.AnsiBStr)]string filedir,
- [MarshalAs(UnmanagedType.AnsiBStr)]string path);
Add Comment
Please, Sign In to add comment