أريد عمل ملف Dll يحوي هذا الclass بالدوت نت
ميزته يقراء الملفات المفتوحة من قبل عمليات أخرى
كيف أتخلص من أخطائه
// This is the main DLL file.
#include "stdafx.h"
#include "FileReader.h"
// This is the main project file for VC++ application project
// generated using an Application Wizard.
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <vcclr.h>
#using <mscorlib.dll>
using namespace System;
using namespace System::IO;
__gc class MyReader
{
private:
FILE* in;
public:
MyReader(String __gc* path)
{
const wchar_t __pin* p = PtrToStringChars(path);
in = _wfopen( p, L"rb");
if (!in)
throw new IOException(S"Not Found");
}
public:
System::UInt64 Read(System::Byte buffer [], System::UInt64 length)
{
void* buf = malloc(length);
IntPtr p = buf;
System::UInt64 r = fread(buf, sizeof(char), length, in);
System::Runtime::InteropServices::Marshal::Copy(
p, buffer, 0, r);
free(buf);
return r;
}
public:
void Close()
{
fclose(in);
}
};أرجو سرعة الرد