Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Comparing C strings and descriptors

From Wiki
Jump to: navigation, search
Article Metadata
Created: ebra (20 Nov 2007)
Last edited: lpvalente (29 Mar 2013)


Standard C strings and Symbian descriptors are by nature very different. The main difference is that descriptors know how many characters are in a data array. A C string doesn’t know its length, so when length is needed, the NULL character that indicates the end of the string has to be scanned.

Another difference arises with buffers. When C code reserves a buffer from the heap or stack, it has to keep the maximum length somewhere. Many C methods that alter the buffer contents do not respect the maximum size of the buffer and can override the reserved memory, causing unknown behavior. Buffer descriptors can tell the maximum length, and all the methods they provide respect the buffer limits.

When using neutral descriptor types there is no need to worry about character widths. In a C program, the programmer has to explicitly specify which method to use, for example strcat or wcscat.


- Write formatted data to a string

C string

sprintf, swprintf

Symbian descriptor


- Append a string to another

C string

strcat, wcscat, strncat, wcsncat

Symbian descriptor


- Compare strings lexicographically

C string

strcmp, strncmp, wcsncmp

Symbian descriptor


- Copy a string to another

C string

strcpy, wcscpy, strncpy, wcsncpy

Symbian descriptor


- Find a character in a string

C string

strchr, wcschr

Symbian descriptor


- Find a substring

C string

strstr, wcsstr

Symbian descriptor


- Get the length of a string

C string

strlen, wcslen

Symbian descriptor


- Compare strings using locale specific information

C string

strcoll, wcscoll

Symbian descriptor


- Format a time string

C string

strftime, wcsftime

Symbian descriptor

This page was last modified on 29 March 2013, at 18:10.
30 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.