📄 cpl__vsi_8h.html
字号:
</div><div class="memdoc"><p>Close file. <p>This function closes the indicated file.<p>This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.<p>Analog of the POSIX fclose() function.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>fp</em> </td><td>file handle opened with <a class="el" href="cpl__vsi_8h.html#48b5fab6cc22a9d0a543c095ee358634">VSIFOpenL()</a>.</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on failure. </dd></dl></div></div><p><a class="anchor" name="9e4f504264ad821b81bd26744a9c291f"></a><!-- doxytag: member="cpl_vsi.h::VSIFEofL" ref="9e4f504264ad821b81bd26744a9c291f" args="(FILE *)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">int VSIFEofL </td> <td>(</td> <td class="paramtype">FILE * </td> <td class="paramname"> <em>fp</em> </td> <td> ) </td> <td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Test for end of file. <p>Returns TRUE (non-zero) if the file read/write offset is currently at the end of the file.<p>This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.<p>Analog of the POSIX feof() call.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>fp</em> </td><td>file handle opened with <a class="el" href="cpl__vsi_8h.html#48b5fab6cc22a9d0a543c095ee358634">VSIFOpenL()</a>.</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>TRUE if at EOF else FALSE. </dd></dl></div></div><p><a class="anchor" name="1e43bee7439e2da7f59bfa8c4d9ff473"></a><!-- doxytag: member="cpl_vsi.h::VSIFFlushL" ref="1e43bee7439e2da7f59bfa8c4d9ff473" args="(FILE *)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">int VSIFFlushL </td> <td>(</td> <td class="paramtype">FILE * </td> <td class="paramname"> <em>fp</em> </td> <td> ) </td> <td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Flush pending writes to disk. <p>For files in write or update mode and on filesystem types where it is applicable, all pending output on the file is flushed to the physical disk.<p>This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.<p>Analog of the POSIX fflush() call.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>fp</em> </td><td>file handle opened with <a class="el" href="cpl__vsi_8h.html#48b5fab6cc22a9d0a543c095ee358634">VSIFOpenL()</a>.</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on error. </dd></dl></div></div><p><a class="anchor" name="1ecb3a78729ecea4d2ce22065a605244"></a><!-- doxytag: member="cpl_vsi.h::VSIFileFromMemBuffer" ref="1ecb3a78729ecea4d2ce22065a605244" args="(const char *pszFilename, GByte *pabyData, vsi_l_offset nDataLength, int bTakeOwnership)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">FILE* VSIFileFromMemBuffer </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszFilename</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">GByte * </td> <td class="paramname"> <em>pabyData</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">vsi_l_offset </td> <td class="paramname"> <em>nDataLength</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>bTakeOwnership</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Create memory "file" from a buffer. <p>A virtual memory file is created from the passed buffer with the indicated filename. Under normal conditions the filename would need to be absolute and within the /vsimem/ portion of the filesystem.<p>If bTakeOwnership is TRUE, then the memory file system handler will take ownership of the buffer, freeing it when the file is deleted. Otherwise it remains the responsibility of the caller, but should not be freed as long as it might be accessed as a file. In no circumstances does this function take a copy of the pabyData contents.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>pszFilename</em> </td><td>the filename to be created. </td></tr> <tr><td valign="top"></td><td valign="top"><em>pabyData</em> </td><td>the data buffer for the file. </td></tr> <tr><td valign="top"></td><td valign="top"><em>nDataLength</em> </td><td>the length of buffer in bytes. </td></tr> <tr><td valign="top"></td><td valign="top"><em>bTakeOwnership</em> </td><td>TRUE to transfer "ownership" of buffer or FALSE.</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>open file handle on created file (see <a class="el" href="cpl__vsi_8h.html#48b5fab6cc22a9d0a543c095ee358634">VSIFOpenL()</a>). </dd></dl></div></div><p><a class="anchor" name="48b5fab6cc22a9d0a543c095ee358634"></a><!-- doxytag: member="cpl_vsi.h::VSIFOpenL" ref="48b5fab6cc22a9d0a543c095ee358634" args="(const char *, const char *)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">FILE* VSIFOpenL </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszFilename</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszAccess</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Open file. <p>This function opens a file with the desired access. Large files (larger than 2GB) should be supported. Binary access is always implied and the "b" does not need to be included in the pszAccess string.<p>Note that the "FILE *" returned by this function is not really a standard C library FILE *, and cannot be used with any functions other than the "VSI*L" family of functions. They aren't "real" FILE objects.<p>This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.<p>Analog of the POSIX fopen() function.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>pszFilename</em> </td><td>the file to open. </td></tr> <tr><td valign="top"></td><td valign="top"><em>pszAccess</em> </td><td>access requested (ie. "r", "r+", "w".</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>NULL on failure, or the file handle. </dd></dl></div></div><p><a class="anchor" name="64335c9b9395cf8b40273a9cce4b46bf"></a><!-- doxytag: member="cpl_vsi.h::VSIFReadL" ref="64335c9b9395cf8b40273a9cce4b46bf" args="(void *, size_t, size_t, FILE *)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">size_t VSIFReadL </td> <td>(</td> <td class="paramtype">void * </td> <td class="paramname"> <em>pBuffer</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"> <em>nSize</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"> <em>nCount</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">FILE * </td> <td class="paramname"> <em>fp</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Read bytes from file. <p>Reads nCount objects of nSize bytes from the indicated file at the current offset into the indicated buffer.<p>This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.<p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -