At 07:54 AM 30/08/2004 -0400, Jonathan Pryor     wrote:
>On Mon, 2004-08-30 at 04:01, Артем Попов wrote:
>> I'd like to wrap some native code that has lots of functions with FILE*-
>> args and I want to pass at least to kind of Stream from the class
>> library to them (the Memory Stream and the File Stream)
>
[snip]
>This is one of the reasons why C++ introduced iostreams (that, and to
>have type-safe I/O of class objects without needing extra casts).
>
>Consequently, if you want to read data written to a FILE*, you have to
>use a temporary file first, and then read the file afterward.

There is one other possibility: make your own version of fopen(), fread(),
etc., using your own polymorphic structure and mono_runtime_invoke calls to
call back into a Stream if the handle is based on one. I've used this
approach myself to write highly-generic C code that could, e.g., open a
block of memory like a file.

Jonathan

_______________________________________________
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list
  • [M... Scott
    • ... Артем Попов
      • ... Артем Попов
    • Jonathan Gilbert

Reply via email to