Example #1
0
        public void H5Fget_files_imageTest2()
        {
            string fname = Path.GetTempFileName();
            hid_t  file  = H5F.create(fname, H5F.ACC_TRUNC);

            Assert.IsTrue(file >= 0);

            IntPtr  buf_len = new IntPtr();
            ssize_t size    = H5F.get_file_image(file, IntPtr.Zero, buf_len);

            Assert.IsTrue(size.ToInt32() > 0);

            IntPtr buf = Marshal.AllocHGlobal((int)size);

            Assert.IsTrue(buf != IntPtr.Zero);

            Assert.IsTrue(H5F.get_file_image(file, IntPtr.Zero,
                                             buf_len).ToInt32() > 0);

            Marshal.FreeHGlobal(buf);

            Assert.IsTrue(H5F.close(file) >= 0);
            File.Delete(fname);
        }
Example #2
0
        public void H5Fget_files_imageTest1()
        {
            string fname = Path.GetTempFileName();
            hid_t  file  = H5F.create(fname, H5F.ACC_TRUNC);

            Assert.IsTrue(file >= 0);

            IntPtr  buf_len = new IntPtr();
            ssize_t size    = H5F.get_file_image(file, IntPtr.Zero, buf_len);

            Assert.IsTrue(size.ToInt32() > 0);

            IntPtr buf = H5.allocate_memory(new IntPtr(size.ToInt32()), 1);

            Assert.IsTrue(buf != IntPtr.Zero);

            Assert.IsTrue(H5F.get_file_image(file, IntPtr.Zero,
                                             buf_len).ToInt32() > 0);

            Assert.IsTrue(H5.free_memory(buf) >= 0);

            Assert.IsTrue(H5F.close(file) >= 0);
            File.Delete(fname);
        }