Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Converting TCHAR

Posted on 2006-06-20
4
Medium Priority
?
758 Views
Last Modified: 2013-12-14
Hi,

I would like to do following thing:

TCHAR dataType[128];
SDWORD cbdatatype;
SQLGetData(hstmt, 1, SQL_C_CHAR, dataType, sizeof(dataType), &cbdatatype);

if(dataType == "VARCHAR")
{
...
}

the problem is that I cannot compare "VARCHAR" with an array of tchars.


Does someone has a solution?


thx.
0
Comment
Question by:davyberroho
  • 2
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
Jase-Coder earned 2000 total points
ID: 16941462
you have to use strcmp
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 16941547
Use _tcscmp function, this is strcmp for TCHAR type:

if(_tcscmp(dataType, _T("VARCHAR") == 0 )
{
}

0
 
LVL 48

Expert Comment

by:AlexFM
ID: 16941554
Read more about TCHAR and Unicode here:
http://www.codeproject.com/cpp/unicode.asp
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question