📄 cpl__conv_8h.html
字号:
<tr> <td class="memname">void* CPLCalloc </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">size_t </td> <td class="paramname"> <em>nSize</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>Safe version of calloc().<p>This function is like the C library calloc(), but raises a CE_Fatal error with <a class="el" href="cpl__error_8h.html#ad2b98dd58e4de706a245faddac90403">CPLError()</a> if it fails to allocate the desired memory. It should be used for small memory allocations that are unlikely to fail and for which the application is unwilling to test for out of memory conditions. It uses VSICalloc() to get the memory, so any hooking of VSICalloc() will apply to <a class="el" href="cpl__conv_8h.html#5b990672a0221115c9b54a8931554136">CPLCalloc()</a> as well. CPLFree() or VSIFree() can be used free memory allocated by <a class="el" href="cpl__conv_8h.html#5b990672a0221115c9b54a8931554136">CPLCalloc()</a>.<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>nCount</em> </td><td>number of objects to allocate. </td></tr> <tr><td valign="top"></td><td valign="top"><em>nSize</em> </td><td>size (in bytes) of object to allocate. </td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>pointer to newly allocated memory, only NULL if nSize * nCount is NULL. </dd></dl></div></div><p><a class="anchor" name="c8ed75603810ed09726ebff3463ba80b"></a><!-- doxytag: member="cpl_conv.h::CPLCleanTrailingSlash" ref="c8ed75603810ed09726ebff3463ba80b" args="(const char *)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* CPLCleanTrailingSlash </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>Remove trailing forward/backward slash from the path for unix/windows resp.<p>Returns a string containing the portion of the passed path string with trailing slash removed. If there is no path in the passed filename an empty string will be returned (not NULL).<p><pre> CPLCleanTrailingSlash( "abc/def/" ) == "abc/def" CPLCleanTrailingSlash( "abc/def" ) == "abc/def" CPLCleanTrailingSlash( "c:\abc\def\" ) == "c:\abc\def" CPLCleanTrailingSlash( "c:\abc\def" ) == "c:\abc\def" CPLCleanTrailingSlash( "abc" ) == "abc" </pre><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>pszPath</em> </td><td>the path to be cleaned up</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>Path in an internal string which must not be freed. The string may be destroyed by the next CPL filename handling call. The returned will generally not contain a trailing path separator. </dd></dl></div></div><p><a class="anchor" name="1afd2c936bbf27a74b02ae6dcadf25a7"></a><!-- doxytag: member="cpl_conv.h::CPLCloseShared" ref="1afd2c936bbf27a74b02ae6dcadf25a7" args="(FILE *)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">void CPLCloseShared </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>Close shared file.<p>Dereferences the indicated file handle, and closes it if the reference count has dropped to zero. A <a class="el" href="cpl__error_8h.html#ad2b98dd58e4de706a245faddac90403">CPLError()</a> is issued if the file is not in the shared file list.<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 from <a class="el" href="cpl__conv_8h.html#f47485362aca554e37796c352a77fc71">CPLOpenShared()</a> to deaccess. </td></tr> </table></dl></div></div><p><a class="anchor" name="97b69cc886a1a5c9618612d8205600e4"></a><!-- doxytag: member="cpl_conv.h::CPLDecToPackedDMS" ref="97b69cc886a1a5c9618612d8205600e4" args="(double dfDec)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">double CPLDecToPackedDMS </td> <td>(</td> <td class="paramtype">double </td> <td class="paramname"> <em>dfDec</em> </td> <td> ) </td> <td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Convert decimal degrees into packed DMS value (DDDMMMSSS.SS).<p>This function converts a value, specified in decimal degrees into packed DMS angle. The standard packed DMS format is:<p>degrees * 1000000 + minutes * 1000 + seconds<p>See also <a class="el" href="cpl__conv_8h.html#a4ffc8fd25881635e18d1a53e177a8e1">CPLPackedDMSToDec()</a>.<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>dfDec</em> </td><td>Angle in decimal degrees.</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>Angle in packed DMS format. </dd></dl></div></div><p><a class="anchor" name="a7709a32d13e10f2c6c28a176b5a8784"></a><!-- doxytag: member="cpl_conv.h::CPLDumpSharedList" ref="a7709a32d13e10f2c6c28a176b5a8784" args="(FILE *)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">void CPLDumpSharedList </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>Report open shared files.<p>Dumps all open shared files to the indicated file handle. If the file handle is NULL information is sent via the <a class="el" href="cpl__error_8h.html#d0c5d3481dd34c1f3a0f7775ebf74817">CPLDebug()</a> 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 to write to. </td></tr> </table></dl></div></div><p><a class="anchor" name="1f558377064b63f76eefb4065368f8e2"></a><!-- doxytag: member="cpl_conv.h::CPLExtractRelativePath" ref="1f558377064b63f76eefb4065368f8e2" args="(const char *, const char *, int *)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* CPLExtractRelativePath </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszBaseDir</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszTarget</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int * </td> <td class="paramname"> <em>pbGotRelative</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 relative path from directory to target file.<p>Computes a relative path for pszTarget relative to pszBaseDir. Currently this only works if they share a common base path. The returned path is normally into the pszTarget string. It should only be considered valid as long as pszTarget is valid or till the next call to this function, whichever comes first.<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>pszBaseDir</em> </td><td>the name of the directory relative to which the path should be computed. pszBaseDir may be NULL in which case the original target is returned without relitivizing.</td></tr> <tr><td valign="top"></td><td valign="top"><em>pszTarget</em> </td><td>the filename to be changed to be relative to pszBaseDir.</td></tr> <tr><td valign="top"></td><td valign="top"><em>pbGotRelative</em> </td><td>Pointer to location in which a flag is placed indicating that the returned path is relative to the basename (TRUE) or not (FALSE). This pointer may be NULL if flag is not desired.</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>an adjusted path or the original if it could not be made relative to the pszBaseFile's path. </dd></dl></div></div><p><a class="anchor" name="98e99149a5cb64a79c6a683dc4a4efe2"></a><!-- doxytag: member="cpl_conv.h::CPLFGets" ref="98e99149a5cb64a79c6a683dc4a4efe2" args="(char *, int, FILE *)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">char* CPLFGets </td> <td>(</td> <td class="paramtype">char * </td> <td class="paramname"> <em>pszBuffer</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>nBufferSize</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>Reads in at most one less than nBufferSize characters from the fp stream and stores them into the buffer pointed to by pszBuffer. Reading stops after an EOF or a newline. If a newline is read, it is _not_ stored into the buffer. A '' is stored after the last character in the buffer. All three types of newline terminators recognized by the <a class="el" href="cpl__conv_8h.html#98e99149a5cb64a79c6a683dc4a4efe2">CPLFGets()</a>: single '' and '<br>' and '<br>' combination.<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>pszBuffer</em> </td><td>pointer to the targeting character buffer. </td></tr> <tr><td valign="top"></td><td valign="top"><em>nBufferSize</em> </td><td>maximum size of the string to read (not including termonating ''). </td></tr> <tr><td valign="top"></td><td valign="top"><em>fp</em> </td><td>file pointer to read from. </td></tr> </table></dl>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -