📄 cpl__conv_8h.html
字号:
<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><dl class="return" compact><dt><b>Returns:</b></dt><dd>pointer to the pszBuffer containing a string read from the file or NULL if the error or end of file was encountered. </dd></dl></div></div><p><a class="anchor" name="9c76b24b06830f0da04fe076177f9ff3"></a><!-- doxytag: member="cpl_conv.h::CPLFormCIFilename" ref="9c76b24b06830f0da04fe076177f9ff3" args="(const char *pszPath, const char *pszBasename, const char *pszExtension)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* CPLFormCIFilename </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszPath</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszBasename</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszExtension</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>Case insensitive file searching, returing full path.<p>This function tries to return the path to a file regardless of whether the file exactly matches the basename, and extension case, or is all upper case, or all lower case. The path is treated as case sensitive. This function is equivelent to <a class="el" href="cpl__conv_8h.html#ee0f81afed5b1b31da1b401822c7a2fb">CPLFormFilename()</a> on case insensitive file systems (like Windows).<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>directory path to the directory containing the file. This may be relative or absolute, and may have a trailing path separator or not. May be NULL.</td></tr> <tr><td valign="top"></td><td valign="top"><em>pszBasename</em> </td><td>file basename. May optionally have path and/or extension. May not be NULL.</td></tr> <tr><td valign="top"></td><td valign="top"><em>pszExtension</em> </td><td>file extension, optionally including the period. May be NULL.</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>a fully formed filename in an internal static string. Do not modify or free the returned string. The string may be destroyed by the next CPL call. </dd></dl></div></div><p><a class="anchor" name="ee0f81afed5b1b31da1b401822c7a2fb"></a><!-- doxytag: member="cpl_conv.h::CPLFormFilename" ref="ee0f81afed5b1b31da1b401822c7a2fb" args="(const char *pszPath, const char *pszBasename, const char *pszExtension)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* CPLFormFilename </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszPath</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszBasename</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszExtension</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>Build a full file path from a passed path, file basename and extension.<p>The path, and extension are optional. The basename may in fact contain an extension if desired.<p><pre> CPLFormFilename("abc/xyz","def", ".dat" ) == "abc/xyz/def.dat" CPLFormFilename(NULL,"def", NULL ) == "def" CPLFormFilename(NULL,"abc/def.dat", NULL ) == "abc/def.dat" CPLFormFilename("/abc/xyz/","def.dat", NULL ) == "/abc/xyz/def.dat" </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>directory path to the directory containing the file. This may be relative or absolute, and may have a trailing path separator or not. May be NULL.</td></tr> <tr><td valign="top"></td><td valign="top"><em>pszBasename</em> </td><td>file basename. May optionally have path and/or extension. May not be NULL.</td></tr> <tr><td valign="top"></td><td valign="top"><em>pszExtension</em> </td><td>file extension, optionally including the period. May be NULL.</td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>a fully formed filename in an internal static string. Do not modify or free the returned string. The string may be destroyed by the next CPL call. </dd></dl></div></div><p><a class="anchor" name="913ec8c102e1dd312d9447cd815a8673"></a><!-- doxytag: member="cpl_conv.h::CPLGetBasename" ref="913ec8c102e1dd312d9447cd815a8673" args="(const char *)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">const char* CPLGetBasename </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>pszFullFilename</em> </td> <td> ) </td> <td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Extract basename (non-directory, non-extension) portion of filename.<p>Returns a string containing the file basename portion of the passed name. If there is no basename (passed value ends in trailing directory separator, or filename starts with a dot) an empty string is returned.<p><pre> CPLGetBasename( "abc/def.xyz" ) == "def" CPLGetBasename( "abc/def" ) == "def" CPLGetBasename( "abc/def/" ) == "" </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>pszFullFilename</em> </td><td>the full filename potentially including a path.</td></tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -