Symbian3/SDK/Source/GUID-80F2DEC8-152F-4681-A9D0-8EB776131313.dita
changeset 8 ae94777fff8f
parent 7 51a74ef9ed63
child 13 48780e181b38
equal deleted inserted replaced
7:51a74ef9ed63 8:ae94777fff8f
    12 <concept id="GUID-80F2DEC8-152F-4681-A9D0-8EB776131313" xml:lang="en"><title>String
    12 <concept id="GUID-80F2DEC8-152F-4681-A9D0-8EB776131313" xml:lang="en"><title>String
    13 Conversions</title><shortdesc>In case the developer is developing applications where P.I.P.S.-based
    13 Conversions</title><shortdesc>In case the developer is developing applications where P.I.P.S.-based
    14 functionality is called from a Symbian/S60 application, the need for conversions
    14 functionality is called from a Symbian/S60 application, the need for conversions
    15 between Symbian descriptors and different string types provided by P.I.P.S.
    15 between Symbian descriptors and different string types provided by P.I.P.S.
    16 is needed. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
    16 is needed. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
    17 <section id="GUID-A6479BB3-0176-4321-8D33-1465DCCAB049-GENID-1-8-1-11-1-1-5-1-3-1-7-1-10-1-3-1">       <title>Symbian
    17 <section id="GUID-A6479BB3-0176-4321-8D33-1465DCCAB049-GENID-1-10-1-11-1-1-5-1-3-1-7-1-10-1-3-1">       <title>Symbian
    18 descriptors and C strings compared</title>       <p>The main difference between
    18 descriptors and C strings compared</title>       <p>The main difference between
    19 Symbian descriptors and C strings is that the Symbian descriptors know how
    19 Symbian descriptors and C strings is that the Symbian descriptors know how
    20 many characters are in a data array. A C string does not know its length,
    20 many characters are in a data array. A C string does not know its length,
    21 so when length is needed the NULL character that indicates the end of the
    21 so when length is needed the NULL character that indicates the end of the
    22 string has to be scanned.  </p><p>Another difference arises with buffers.
    22 string has to be scanned.  </p><p>Another difference arises with buffers.
   108 <entry><p>Format a time string. </p></entry>
   108 <entry><p>Format a time string. </p></entry>
   109 </row>
   109 </row>
   110 </tbody>
   110 </tbody>
   111 </tgroup>
   111 </tgroup>
   112 </table>     </section>
   112 </table>     </section>
   113 <section id="GUID-A6479BB3-0176-4321-8D33-1465DCCAB049-GENID-1-8-1-11-1-1-5-1-3-1-7-1-10-1-3-2">       <title>How
   113 <section id="GUID-A6479BB3-0176-4321-8D33-1465DCCAB049-GENID-1-10-1-11-1-1-5-1-3-1-7-1-10-1-3-2">       <title>How
   114 to convert <codeph>TBuf16</codeph> to a <codeph>char</codeph> buffer</title> 
   114 to convert <codeph>TBuf16</codeph> to a <codeph>char</codeph> buffer</title> 
   115      <p>A <codeph>TBuf16</codeph> buffer can be converted to a <codeph>char</codeph> buffer
   115      <p>A <codeph>TBuf16</codeph> buffer can be converted to a <codeph>char</codeph> buffer
   116 using the <codeph>wcstombs</codeph> API. The example below illustrates how
   116 using the <codeph>wcstombs</codeph> API. The example below illustrates how
   117 the conversion can be done.</p><codeblock xml:space="preserve">#include &lt;e32base.h&gt;
   117 the conversion can be done.</p><codeblock xml:space="preserve">#include &lt;e32base.h&gt;
   118 #include &lt;sys/types.h&gt;
   118 #include &lt;sys/types.h&gt;
   133     printf("TBuf converted to char buffer : %s\n",carray);
   133     printf("TBuf converted to char buffer : %s\n",carray);
   134     getchar();
   134     getchar();
   135     return (1);
   135     return (1);
   136 }
   136 }
   137 </codeblock>     </section>
   137 </codeblock>     </section>
   138 <section id="GUID-A6479BB3-0176-4321-8D33-1465DCCAB049-GENID-1-8-1-11-1-1-5-1-3-1-7-1-10-1-3-3">       <title>How
   138 <section id="GUID-A6479BB3-0176-4321-8D33-1465DCCAB049-GENID-1-10-1-11-1-1-5-1-3-1-7-1-10-1-3-3">       <title>How
   139 to convert <codeph>TBuf8</codeph> to <codeph>wchar_t</codeph></title>    
   139 to convert <codeph>TBuf8</codeph> to <codeph>wchar_t</codeph></title>    
   140   <p>A <codeph>TBuf8</codeph> buffer can be converted to <codeph>wchar_t</codeph> using
   140   <p>A <codeph>TBuf8</codeph> buffer can be converted to <codeph>wchar_t</codeph> using
   141 the <codeph>mbstowcs</codeph> API.</p><codeblock xml:space="preserve">#include &lt;e32base.h&gt;
   141 the <codeph>mbstowcs</codeph> API.</p><codeblock xml:space="preserve">#include &lt;e32base.h&gt;
   142 #include &lt;sys/types.h&gt;
   142 #include &lt;sys/types.h&gt;
   143 #include &lt;stdio.h&gt;
   143 #include &lt;stdio.h&gt;
   157      getchar();
   157      getchar();
   158      
   158      
   159      return (1);
   159      return (1);
   160  }
   160  }
   161 </codeblock>     </section>
   161 </codeblock>     </section>
   162 <section id="GUID-A6479BB3-0176-4321-8D33-1465DCCAB049-GENID-1-8-1-11-1-1-5-1-3-1-7-1-10-1-3-4">       <title>How
   162 <section id="GUID-A6479BB3-0176-4321-8D33-1465DCCAB049-GENID-1-10-1-11-1-1-5-1-3-1-7-1-10-1-3-4">       <title>How
   163 to convert <codeph>TText16</codeph> to <codeph>char</codeph></title>     
   163 to convert <codeph>TText16</codeph> to <codeph>char</codeph></title>     
   164  <p>The <codeph>wcstombs</codeph> API can be used to convert a <codeph>TText16</codeph> buffer
   164  <p>The <codeph>wcstombs</codeph> API can be used to convert a <codeph>TText16</codeph> buffer
   165 to a <codeph>char</codeph> buffer. This is one of the examples of converting
   165 to a <codeph>char</codeph> buffer. This is one of the examples of converting
   166 from a Symbian data type to a C data type.</p><codeblock xml:space="preserve">#include &lt;e32def.h&gt;
   166 from a Symbian data type to a C data type.</p><codeblock xml:space="preserve">#include &lt;e32def.h&gt;
   167 #include &lt;sys/types.h&gt;
   167 #include &lt;sys/types.h&gt;
   182    getchar();
   182    getchar();
   183 
   183 
   184    return (1);
   184    return (1);
   185 }
   185 }
   186 </codeblock>     </section>
   186 </codeblock>     </section>
   187 <section id="GUID-A6479BB3-0176-4321-8D33-1465DCCAB049-GENID-1-8-1-11-1-1-5-1-3-1-7-1-10-1-3-5">       <title>How
   187 <section id="GUID-A6479BB3-0176-4321-8D33-1465DCCAB049-GENID-1-10-1-11-1-1-5-1-3-1-7-1-10-1-3-5">       <title>How
   188 to convert a <codeph>char</codeph> array and a <codeph>wide char</codeph> array</title> 
   188 to convert a <codeph>char</codeph> array and a <codeph>wide char</codeph> array</title> 
   189      <p>To use both <codeph>char</codeph> and <codeph>wide char</codeph> pointers
   189      <p>To use both <codeph>char</codeph> and <codeph>wide char</codeph> pointers
   190 or array in the program, the user must convert buffers from a <codeph>char</codeph> to
   190 or array in the program, the user must convert buffers from a <codeph>char</codeph> to
   191 a <codeph>wide char</codeph> and vice versa. Wide character APIs provide methods
   191 a <codeph>wide char</codeph> and vice versa. Wide character APIs provide methods
   192 to: </p><ul>
   192 to: </p><ul>
   229    getwchar();
   229    getwchar();
   230 
   230 
   231    return (1);
   231    return (1);
   232 }
   232 }
   233 </codeblock>     </section>
   233 </codeblock>     </section>
   234 <section id="GUID-A6479BB3-0176-4321-8D33-1465DCCAB049-GENID-1-8-1-11-1-1-5-1-3-1-7-1-10-1-3-6">       <title>How
   234 <section id="GUID-A6479BB3-0176-4321-8D33-1465DCCAB049-GENID-1-10-1-11-1-1-5-1-3-1-7-1-10-1-3-6">       <title>How
   235 to declare a <codeph>wide-char</codeph> string</title>       <p>To declare
   235 to declare a <codeph>wide-char</codeph> string</title>       <p>To declare
   236 a <codeph>wide-char</codeph> string, prefix the string with 'L'
   236 a <codeph>wide-char</codeph> string, prefix the string with 'L'
   237 [Capital L].  </p><codeblock xml:space="preserve">#include &lt;wchar.h&gt;
   237 [Capital L].  </p><codeblock xml:space="preserve">#include &lt;wchar.h&gt;
   238 
   238 
   239 int main(void)
   239 int main(void)