All pastes #20649 Raw Edit

Mine

public text v1 · immutable
#20649 ·published 2005-08-21 17:51 UTC
rendered paste body
using System;
using System.Runtime.InteropServices;

class MainClass
{
        [DllImport("libc")]
        static extern void printf(string data);

        [DllImport("libc")]
        static extern IntPtr fopen(string path, string mode);

        [DllImport("libc")]
        static extern int fwrite(string data, int size, int nmemb, IntPtr stream);

        static void Main()
        {
                printf("Hello World via libc!\n");

                IntPtr file = fopen("test.txt", "w+");
                string msg = "fwrite from mono!\n";
                fwrite(msg, msg.Length, 1, file);
        }
}