HDFGroup / HDFGroup/HDF.PInvoke

Error changing the file stream for HDF5 error function H5E.print

Open
#149 3 comments 0 reactions 1 assignee Claimed by @gheber View on GitHub
help wanted question
Dominant language
C#
Stars
87
Forks
31
PR merge metrics
No merged PRs in 30d

Description

When a HDF5 function fails it generates the error and itself prints the error in console in an console application. In another case, you can mute the automatic error printing from the stack using H5E.set_auto() and then print the message explicitly using H5E.print. Full documentation available here.

herr_t H5Eprint( hid_t estack_id, FILE * stream) )

For C#, this syntax is

int H5E.print( Int64 estack_id, Intptr stream) )

I want to redirect this error message from console to a .txt file. I am getting AccessViolation exception when I am using

string filePath = @"d:\errors.txt";
errorFileStream = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.Write);
errorFileHandle = errorFileStream.SafeFileHandle.DangerousGetHandle();
H5E.print(estack_id, errorFileHandle)

How to get rid of this exception? Am I going correct?

I am using HDF.PInvoke version 1.10.0.4 in C# in Visual Studio 2015.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.