Friends i need to convert TCHAR to Boolean value
This is what i want

_TCHAR gstrEnableproxy="false"
boolean x=false

and the code i have written is

void convertStringBoolean(String* TCHAR)
    bool boolVal = false;
        boolVal = system::Convert::ToBoolean(TCHAR);
        System::Console::WriteLine("The string TCHAR* System::Boolean::TrueString or System::Boolean::flasestring");

Its giving me error and i have try some more way but no use i want to convert TCHAR to boolean

I am writing code in VC++ 2005 version

please help.

Thanks in advance

6 Years
Discussion Span
Last Post by Ancient Dragon

What the hell is that???

>>void convertStringBoolean(String* TCHAR)
Don't use TCHAR as a variable name because it's a macro defined in standard header file tchar.h which expands to either char and wchar_t depending on whether UNICODE is defined or not.

What is the actual value of that string? Is it either "true" or "false", or is it something else.

Why don't you just say

bool convertStringBoolean(String* str)
   return (str == "true") ? true : false;


Very first thing dont be so rude...

i want to mention is i have not use TCHAR as variable
I have use it as a type

and i want to convert


>>Very first thing dont be so rude...
I'm not rude. If you want to see rude go to here and see posts by DaWei.

>>i want to mention is i have not use TCHAR as variable
Yes you did. In this line void convertStringBoolean(String* TCHAR) the use of TCHAR is a variable name, String is a type.

And while I'm at it I will suggest you upgrade to VC++ 2010 if you can because CLI langusage has changed since your version of the compiler. For example String* is now String^

Edited by Ancient Dragon: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.