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}"); }
public static int scanf(this msvcrt lib, string fmt, out int arg0) => lib.GetFunction <pinvoke_scanf_1>("scanf")(fmt, out arg0);
public static int printf(this msvcrt lib, string fmt, float arg0) => lib.GetFunction <pinvoke_printf_2>("printf")(fmt, arg0);
public static int strlen(this msvcrt lib, string str) => lib.GetFunction <pinvoke_strlen>("strlen")(str);