How to convert string into PCHAR?

This is a discussion on How to convert string into PCHAR? within the C++ Programming forums, part of the General Programming Boards category; Hi All I want to convert string into PCHAR. How can I do that? Please help.. Thanks Ketu...

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    24

    Question How to convert string into PCHAR?

    Hi All
    I want to convert string into PCHAR.
    How can I do that?
    Please help..

    Thanks
    Ketu

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,702
    If it's a null terminated char string, you do nothing. If it's a std::string, then use the c_str() method.

    PCHAR is just a typedef for "char *".

    gg

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    I can't find any reference to this PCHAR that isn't Delphi Pascal. Do you just mean pointer to char, or how have you defined PCHAR?

  4. #4
    Registered User
    Join Date
    Jan 2008
    Posts
    24
    Hi
    This is my codde
    iResultCompare=ldap_compare_s(ld,strDN.c_str,vAttT ypeFromFile_m[iCntAtt].c_str(),vAllAttValFromFile_m[iCntAtt][iCntVal].c_str());

    and error is

    error C2664: 'ldap_compare_s' : cannot convert parameter 2 from 'const char *(void) const' to 'const char *'
    There is no context in which this conversion is possible

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    24
    i got it...
    I forgot to put () after c_str
    thanks a lot :-)

  6. #6
    Registered User
    Join Date
    Jan 2007
    Posts
    330
    Damn, at least try learn the language a little bit more before posting VERY basic question to a forum

  7. #7
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    Quote Originally Posted by KIBO View Post
    Damn, at least try learn the language a little bit more before posting VERY basic question to a forum
    Questions that concern understanding of compiler messages are NOT very basic... they are not basic at all.
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 03-03-2006, 02:11 AM
  2. can anyone see anything wrong with this code
    By occ0708 in forum C++ Programming
    Replies: 6
    Last Post: 12-07-2004, 12:47 PM
  3. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM
  4. ........ed off at functions
    By Klinerr1 in forum C++ Programming
    Replies: 8
    Last Post: 07-29-2002, 10:37 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 07:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21