csllbc_Console_SafePrint() private method

private csllbc_Console_SafePrint ( bool toStdout, bool newLine, IntPtr value, int valueLen ) : void
toStdout bool
newLine bool
value System.IntPtr
valueLen int
return void
Ejemplo n.º 1
0
 private static void _Write(bool toStdout, bool newLine, char value)
 {
     unsafe
     {
         byte *bytes = stackalloc byte[32];
         int   wrote = Encoding.UTF8.GetBytes(&value, 1, bytes, 32);
         LLBCNative.csllbc_Console_SafePrint(toStdout, newLine, new IntPtr(bytes), wrote);
     }
 }
Ejemplo n.º 2
0
        private static void _SafeOutput(bool toStdout, bool newLine, string content)
        {
            byte[] bytes = Encoding.UTF8.GetBytes(content);
            if (bytes.Length == 0)
            {
                LLBCNative.csllbc_Console_SafePrint(toStdout, newLine, IntPtr.Zero, 0);
                return;
            }

            unsafe
            {
                fixed(byte *ptr = &bytes[0])
                {
                    LLBCNative.csllbc_Console_SafePrint(toStdout, newLine, new IntPtr(ptr), bytes.Length);
                }
            }
        }