الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مشكلة مع هذاclass أرجو حلها

مغلق
بدأه mossa في 13 أبريل 2005 · 0 رد · 1,616 مشاهدة · في C++.Net
مشاركة: واتساب X فيسبوك تيليجرام
#1

أريد عمل ملف 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);
	}
};

أرجو سرعة الرد

تم تعديل هذه المشاركة بواسطة mossa في 13 أبريل 2005 في 20:51

هذا الموضوع مغلق.

مواضيع مشابهة