Debug todayProgramThe value cstring. getlength In the CS ring object is 0,CodeAs follows:
Cstring m_sername;
Cstring S = "hello"
M_sername = s;
S. getlength () = 0;
Find the cause on the Internet in str1.releasebuffer (); in fact, cstring:
ArticleDirectory
Basic concepts of strings
Implementation of basic string operations
In the ApplicationProgramThe most frequently used type is a string. String is short for string. It is a special line table. Its special feature
4.5.8 String Length
The length of a string usually refers to the number of characters in a string, but sometimes people need the number of bytes occupied by the string. The following methods are commonly used to obtain the length of a string.
1. Use
In C and C ++ languages, a shared space called a heap is provided. During the program running, the system uses the functions malloc () and free () dynamically apply for or release a continuous space.In C and C ++, pointers can be used to access and
Repost an article from someone else first
These functions of the cstring class have been used for a long time, but they are not fully understood. From time to time, there are still errors. Today, I took the time to analyze them with Nico, which is
In VC, cstring is one of our most commonly used classes. We feel familiar with it, but do you know all its usage?
Let's take a look at the system and read this article carefully.
Start as follows:
Cstring: CompareInt compare (lpctstr lpsz)
In this section, we will discuss two types of data structures that use a large number of data structures-strings and arrays.
First of all, what is a string, here is not a beef string, a mutton string, but a string. The most frequently used type in
Many functions in cstring are similar to those in string processing in VB.1. cstring: isemptyBool isempty () const;Return Value: if the length of the cstring object is 0, a non-zero value is returned; otherwise, 0 is returned.Note: This member
Cstring common methods
Cstring: CompareInt compare (lpctstr lpsz) const;Returns 0 if the return value is the same as the string.If the value is less than lpsz,-1 is returned.If the value is greater than lpsz, 1 is returned.Characters of different
The transformation between string,cstring,char*
int Turn CString:Cstring.format ("%d", int);...............................String Turn CStringCstring.format ("%s", String.c_str ());Using C_str () is indeed better than data ()........................
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.