473,382 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

compare CString

how to compare a CString?

the following does not seem to work.

CString id = PictureEntries[i].attribute("id").value();

if (id.Compare("2222") == 1){
cout << id << endl;
}

Nov 17 '08 #1
3 4855
Carl Forsman wrote:
how to compare a CString?
Try a windows group, CString isn't standard C++.

--
Ian Collins
Nov 17 '08 #2
On Nov 16, 10:14 pm, Carl Forsman <fatwallet...@yahoo.comwrote:
how to compare a CString?

the following does not seem to work.

CString id = PictureEntries[i].attribute("id").value();

if (id.Compare("2222") == 1){
cout << id << endl;
}
Whats a CString?

As a hint: what is the difference between a null terminated sequence
of characters and one that isn't null terminated? The point here is
that if you don't know or aren't sure, use a little brain power:

CString id("abcdef")
if( id.Compare( CString("abcdef") )
{
// do stuff
}

Nov 17 '08 #3
Salt_Peter <pj*****@yahoo.comwrote in news:f28eec71-822f-4894-9332-
d7**********@k24g2000pri.googlegroups.com:
On Nov 16, 10:14 pm, Carl Forsman <fatwallet...@yahoo.comwrote:
>how to compare a CString?

the following does not seem to work.

CString id = PictureEntries[i].attribute("id").value();

if (id.Compare("2222") == 1){
cout << id << endl;
}

Whats a CString?

As a hint: what is the difference between a null terminated sequence
of characters and one that isn't null terminated? The point here is
that if you don't know or aren't sure, use a little brain power:

CString id("abcdef")
if( id.Compare( CString("abcdef") )
{
// do stuff
}
Which is why you shouldn't ask CString questions here! The above is
wrong.

if (0 == id.Compare("abcdef"))
{
// do stuff
}

or

if (id == "abcdef")
{
}

The OP also asked in an MS group and "learned" how to make the proper
call. Though the term RTFM was missing in those posts.

Dave Connet
Nov 17 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Rajesh Garg | last post by:
Why and in what situations is CString not preferred? RVG
6
by: Markus Hämmerli | last post by:
I ' ll tra to convert a Cstring to char* without success. I working in a Unicode enabled environment this is working in Unicode CString source = _T("TestString"); TCHAR *szSource =...
8
by: Oskar | last post by:
Hi. I`m new in cpp and i have a litlle problem. i have a CString from Edit Box (eg."aaa bbb ccc 7327373 d feaf 323 dvjiv 234") and i want to put the data (space separated) into an array.It shuld...
3
by: nsyforce | last post by:
What is the correct way to convert a const char* to a CString? I'm somewhat of a newbie and have tried several ways. While they all convert ok, I'm using a profiler that shows a memory leak for...
4
by: mt | last post by:
Hi, W H A T I am considering moving my windows app written in Visual C++ 6.0 to C# .NET. Q U E S T I O N I was wondering if application speed will be a problem in .NET when compared to a...
4
by: huguogang | last post by:
Just curious, any one know what the 3 part parameter "class CString filename" would mean. The code: int TestFunc(class CString filename) { fopen(filename, "w"); } Compile using Visaul C++,...
4
by: Susan Rice | last post by:
I'm new to using CString. Why won't the following compile? I'm using Microsoft Visual C++ 6.0 Line 37 which it complains about is the function: 37 CString ConvertFile(char *szFileName) I...
2
by: flyingxu | last post by:
Hi, I run into a cstring related link problem in VC7. My solution has 3 projects, one MFC exe, two MFC extersion DLL. the two MFC extersion DLL export functions which use CString as parameters....
9
by: Donos | last post by:
I have a CString with 100 characters. Now i want to make that to 2 lines. For example, CString str = "This is just a test to find out how to break a cstring"; I want this CString in the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.