Example #1
0
        private static void Main()
        {
            using var lib = new msvcrt();

            var spot = DateTime.UtcNow;

            for (int i = 0; i < 1000; i++)
            {
                Console.Out.WriteLine($"strlen returns {lib.strlen("aaa")}");

                var result = lib.printf("Hello, World! %d\n", 123);
                Console.Out.WriteLine($"printf returns {result}");

                result = lib.printf("Hello, World! %f\n", 123f);
                Console.Out.WriteLine($"printf returns {result}");
            }

            var duration = DateTime.UtcNow - spot;

            Console.WriteLine($"Elapsed time: {duration}");
        }
Example #2
0
 public static int scanf(this msvcrt lib, string fmt, out int arg0)
 => lib.GetFunction <pinvoke_scanf_1>("scanf")(fmt, out arg0);
Example #3
0
 public static int printf(this msvcrt lib, string fmt, float arg0)
 => lib.GetFunction <pinvoke_printf_2>("printf")(fmt, arg0);
Example #4
0
 public static int strlen(this msvcrt lib, string str)
 => lib.GetFunction <pinvoke_strlen>("strlen")(str);