Extract individual char from LPCSTR

  • 18 years ago

    Forum Index  |   FAQ  |   Edit Profile  |   Send Private  |   Check Private  |   Top 10  |   Search  |   Unanswered  |   Logout  
    Visual C++ Programming


    Subject DLL callback function  
    Category AdvancedUI  
    Posted by shinkm on 5/12/02 at 12:00 pm  
    Rating not rated



    i am trying to extract individual chars from LPCSTR variable inside a callback function. i used the following code.


    LPCSTR lp;
    [section that assigns proper value for lp]
    MessageBox(hwnd, lp, blah, blah); //to make sure lp holds the desired string
    //and i confirmed that lp is assigned properly
    char c0;
    char c1;
    char c2; //for now, i am interested in only the first three char of the string pointed by lp


    c0=(lp);
    c1=
    (lp+1);
    c2=*(lp+2);


    BUT.....it doesn't work. I am not sure what's wrong here. From what I understand, lp is a char*. Please help me out. Thank you in advance.



    Shin





  • 18 years ago

    should the ip be declaired as a char array,, or pointer ????

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Before software should be reusable, it should be usable.” - Ralph Johnson