Esempio n. 1
0
        /// <summary>
        ///  Get logged messages.
        /// </summary>
        public string[] Get()
        {
            IntPtr log   = IntPtr.Zero;
            uint   log_n = 0;

            GMshNativeMethods.gmshLoggerGet(ref log, ref log_n, ref ierr);
            if (ierr != 0)
            {
                throw new GMshException(ierr);
            }

            IntPtr[] str = new IntPtr[log_n];
            Marshal.Copy(log, str, 0, log_n.Toint());
            string[] messages = new string[log_n];

            for (int i = 0; i < log_n; i++)
            {
                messages[i] = Marshal.PtrToStringAnsi(str[i]);
            }
            log.GmshFree();
            return(messages);
        }