📄 cpl__vsi_8h.html
字号:
vsi_l_offset *pnOutDataLength ) { <span class="comment">// create memory file system object from buffer.</span> <a class="code" href="cpl__vsi_8h.html#b1fc5cbfff98db8f5aa912606b07e8d9">VSIFCloseL</a>( <a class="code" href="cpl__vsi_8h.html#1ecb3a78729ecea4d2ce22065a605244">VSIFileFromMemBuffer</a>( <span class="stringliteral">"/vsimem/work.dat"</span>, pabyInData, nInDataLength, FALSE ) ); <span class="comment">// Open memory buffer for read.</span> GDALDatasetH hDS = <a class="code" href="gdal_8h.html#e97be045eb4701183ad332ffce29745b">GDALOpen</a>( <span class="stringliteral">"/vsimem/work.dat"</span>, <a class="code" href="gdal_8h.html#045e3967c208993f70257bfd40c9f1d75a021a550b9d5640307d3c0e7e35b732">GA_ReadOnly</a> ); <span class="comment">// Get output format driver. </span> GDALDriverH hDriver = <a class="code" href="gdal_8h.html#e8ae868eef1e4773283d137b0a1adfc4">GDALGetDriverByName</a>( <span class="stringliteral">"GTiff"</span> ); GDALDatasetH hOutDS; hOutDS = <a class="code" href="gdal_8h.html#c9812351af9d1d6ed2f1ea51cd49ef51">GDALCreateCopy</a>( hDriver, <span class="stringliteral">"/vsimem/out.tif"</span>, hDS, TRUE, NULL, NULL, NULL ); <span class="comment">// close source file, and "unlink" it. </span> <a class="code" href="gdal_8h.html#0984222d45a72028fcbbf1f44831ffbc">GDALClose</a>( hDS ); <a class="code" href="cpl__vsi_8h.html#69dad1bd6f1af9935c1523db0c6c212f">VSIUnlink</a>( <span class="stringliteral">"/vsimem/work.dat"</span> ); <span class="comment">// seize the buffer associated with the output file.</span> <span class="keywordflow">return</span> <a class="code" href="cpl__vsi_8h.html#eaf26bcc4a5314371f426bb2a5e6ce7a">VSIGetMemFileBuffer</a>( <span class="stringliteral">"/vsimem/out.tif"</span>, pnOutDataLength, TRUE ); }</pre></div> </div></div><p><a class="anchor" name="ef0a5243bbc47cf9645a135d0c7d26df"></a><!-- doxytag: member="cpl_vsi.h::VSIMkdir" ref="ef0a5243bbc47cf9645a135d0c7d26df" args="(const char *pathname, long mode)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">int VSIMkdir </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszPathname</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">long </td> <td class="paramname"> <em>mode</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 a directory. <p>Create a new directory with the indicated mode. The mode is ignored on some platforms. A reasonable default mode value would be 0666. This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.<p>Analog of the POSIX mkdir() 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>pszPathname</em> </td><td>the path to the directory to create. </td></tr> <tr><td valign="top"></td><td valign="top"><em>mode</em> </td><td>the permissions mode.</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on an error. </dd></dl></div></div><p><a class="anchor" name="26cae93b5a32e11bef9ec7c118f8cca4"></a><!-- doxytag: member="cpl_vsi.h::VSIRename" ref="26cae93b5a32e11bef9ec7c118f8cca4" args="(const char *oldpath, const char *newpath)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">int VSIRename </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>oldpath</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>newpath</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>Rename a file. <p>Renames a file object in the file system. It should be possible to rename a file onto a new filesystem, but it is safest if this function is only used to rename files that remain in the same directory.<p>This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.<p>Analog of the POSIX rename() 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>oldpath</em> </td><td>the name of the file to be renamed. </td></tr> <tr><td valign="top"></td><td valign="top"><em>newpath</em> </td><td>the name the file should be given.</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on an error. </dd></dl></div></div><p><a class="anchor" name="763cceaa0966f37b71a0185c92bb3ad8"></a><!-- doxytag: member="cpl_vsi.h::VSIRmdir" ref="763cceaa0966f37b71a0185c92bb3ad8" args="(const char *pathname)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">int VSIRmdir </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszDirname</em> </td> <td> ) </td> <td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Delete a directory. <p>Deletes a directory object from the file system. On some systems the directory must be empty before it can be deleted.<p>This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.<p>Analog of the POSIX rmdir() 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>pszDirname</em> </td><td>the path of the directory to be deleted.</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on an error. </dd></dl></div></div><p><a class="anchor" name="c92fbd5e6fc143b026001b32c4c19ed1"></a><!-- doxytag: member="cpl_vsi.h::VSIStatL" ref="c92fbd5e6fc143b026001b32c4c19ed1" args="(const char *, VSIStatBufL *)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">int VSIStatL </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">VSIStatBufL * </td> <td class="paramname"> <em>psStatBuf</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>Get filesystem object info. <p>Fetches status information about a filesystem object (file, directory, etc). The returned information is placed in the VSIStatBufL structure. For portability only the st_size (size in bytes), and st_mode (file type). This method is similar to VSIStat(), but will work on large files on systems where this requires special calls.<p>This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.<p>Analog of the POSIX stat() 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 path of the filesystem object to be queried. </td></tr> <tr><td valign="top"></td><td valign="top"><em>psStatBuf</em> </td><td>the structure to load with information.</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on an error. </dd></dl></div></div><p><a class="anchor" name="69dad1bd6f1af9935c1523db0c6c212f"></a><!-- doxytag: member="cpl_vsi.h::VSIUnlink" ref="69dad1bd6f1af9935c1523db0c6c212f" args="(const char *pathname)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">int VSIUnlink </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszFilename</em> </td> <td> ) </td> <td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Delete a file. <p>Deletes a file object from the file system.<p>This method goes through the VSIFileHandler virtualization and may work on unusual filesystems such as in memory.<p>Analog of the POSIX unlink() 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 path of the file to be deleted.</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on an error. </dd></dl></div></div><p><hr>Generated for GDAL by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1.</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -