# How to Open a file which is in the memory by H5Pset\_fapl\_core?

**URL:** <https://forum.hdfgroup.org/t/how-to-open-a-file-which-is-in-the-memory-by-h5pset-fapl-core/2935>\
**Category:** Hdf-forum archives\
**Created:** [June 21, 2013, 1:20am UTC](https://forum.hdfgroup.org/t/how-to-open-a-file-which-is-in-the-memory-by-h5pset-fapl-core/2935 "2013-06-21T01:20:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![long](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/l/e47774/32.png) [@long](https://forum.hdfgroup.org/u/long)\
**Post date:** [June 21, 2013, 1:20am UTC](https://forum.hdfgroup.org/t/how-to-open-a-file-which-is-in-the-memory-by-h5pset-fapl-core/2935/1 "2013-06-21T01:20:35Z")

</div>

I could create a simple file in memory by

\*fapl = H5Pcreate(H5P\_FILE\_ACCESS);\*  
\*H5Pset\_fapl\_core(fapl,1024,0);\*  
\*file = H5Fcreate(H5FILE\_NAME, H5F\_ACC\_TRUNC, H5P\_DEFAULT, fapl);\*

And I want to use H5Fopen to get this file in memory.  
\*file = H5Fopen(H5FILE\_NAME, H5F\_ACC\_RDWR, fapl);\*

> **···**
>
> \*  
> \*  
> But I failed.  
> The error is:  
> \*HDF5-DIAG: Error detected in HDF5 (1.8.11) thread 0:\*  
> \* #000: H5F.c line 1582 in H5Fopen(): unable to open file\*  
> \* major: File accessibilty\*  
> \* minor: Unable to open file\*  
> \* #001: H5F.c line 1271 in H5F\_open(): unable to open file: time = Fri Jun  
> 21 03:19:11 2013\*  
> \*, name = 'Driver\_test5.h5', tent\_flags = 1\*  
> \* major: File accessibilty\*  
> \* minor: Unable to open file\*  
> \* #002: H5FD.c line 987 in H5FD\_open(): open failed\*  
> \* major: Virtual File Layer\*  
> \* minor: Unable to initialize object\*  
> \* #003: H5FDcore.c line 441 in H5FD\_core\_open(): unable to open file\*  
> \* major: File accessibilty\*  
> \* minor: Unable to open file\*
> 
> The document said :The H5FD\_CORE driver enables an application to work with  
> a file in memory, speeding reads and writes as no disk access is made.
> 
> How to fix it and What should I do?
> 
> Thanks

---

<div class="post-metadata">

**Author:** ![Quincey\_Koziol](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/q/dbc845/32.png) [@Quincey\_Koziol](https://forum.hdfgroup.org/u/Quincey_Koziol)\
**Post date:** [June 27, 2013, 3:25pm UTC](https://forum.hdfgroup.org/t/how-to-open-a-file-which-is-in-the-memory-by-h5pset-fapl-core/2935/2 "2013-06-27T15:25:11Z")

</div>

Hi Long,

> I could create a simple file in memory by
> 
> fapl = H5Pcreate(H5P\_FILE\_ACCESS);  
> H5Pset\_fapl\_core(fapl,1024,0);  
> file = H5Fcreate(H5FILE\_NAME, H5F\_ACC\_TRUNC, H5P\_DEFAULT, fapl);
> 
> And I want to use H5Fopen to get this file in memory.  
> file = H5Fopen(H5FILE\_NAME, H5F\_ACC\_RDWR, fapl);
> 
> But I failed.  
> The error is:  
> HDF5-DIAG: Error detected in HDF5 (1.8.11) thread 0:  
> &nbsp;&nbsp;#000: H5F.c line 1582 in H5Fopen(): unable to open file  
> &nbsp;&nbsp;&nbsp;&nbsp;major: File accessibilty  
> &nbsp;&nbsp;&nbsp;&nbsp;minor: Unable to open file  
> &nbsp;&nbsp;#001: H5F.c line 1271 in H5F\_open(): unable to open file: time = Fri Jun 21 03:19:11 2013  
> , name = 'Driver\_test5.h5', tent\_flags = 1  
> &nbsp;&nbsp;&nbsp;&nbsp;major: File accessibilty  
> &nbsp;&nbsp;&nbsp;&nbsp;minor: Unable to open file  
> &nbsp;&nbsp;#002: H5FD.c line 987 in H5FD\_open(): open failed  
> &nbsp;&nbsp;&nbsp;&nbsp;major: Virtual File Layer  
> &nbsp;&nbsp;&nbsp;&nbsp;minor: Unable to initialize object  
> &nbsp;&nbsp;#003: H5FDcore.c line 441 in H5FD\_core\_open(): unable to open file  
> &nbsp;&nbsp;&nbsp;&nbsp;major: File accessibilty  
> &nbsp;&nbsp;&nbsp;&nbsp;minor: Unable to open file
> 
> The document said :The H5FD\_CORE driver enables an application to work with a file in memory, speeding reads and writes as no disk access is made.
> 
> How to fix it and What should I do?

&nbsp;&nbsp;Try using the "file image" routines:

H5Pset\_file\_image  
H5Pget\_file\_image  
H5Pset\_file\_image\_callbacks  
H5Pget\_file\_image\_callbacks

&nbsp;&nbsp;[http://www.hdfgroup.org/HDF5/doc/RM/RM\_H5P.html](http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html)

&nbsp;&nbsp;&nbsp;&nbsp;Quincey

> **···**
>
> On Jun 20, 2013, at 8:20 PM, long zhao \<comlong@gmail.com\> wrote:
