Results 1 to 10 of 10

Thread: string data type??

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    I'm having trouble with VC++, getting it to recognize the string data type. I have tried including the string.h header like this :

    #include "string.h"

    and like this :

    #include <string>

    and each time I hit Build, an error comes up saying :

    syntax error : identifier 'string'

    any ideas on how to solve it??
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  2. #2
    Addicted Member Active's Avatar
    Join Date
    Jan 2001
    Location
    Lat: 13° 4' 46" N, Long: 80° 15' 20" E
    Posts
    209
    Should it not be..

    #include <string.h>

    ???????
    If you can't beat your computer at chess, try kickboxing !!!
    [Download Tag Editing Tools.]

  3. #3

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    unfortunately, I've tried that as well, with the exact same result. I mean, I have the header file, and the #include statement worked in another compiler I had a while ago...
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  4. #4
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    It used to work for me in CodeWarrior...someone said to try #include <string>

  5. #5

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    alright, lets say, I can't get it to work, is there a built-in string data type?? I saw BStr, or something somewhere, what's that?
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  6. #6
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Use This:
    Code:
    #include <string>
    using namespace std;
    ....
    string mystring;
    mystring = "Something"
    //and so on
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  7. #7

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    WOW!

    If you were here I'd be bending you over my desk and dry-humping you right now!

    Thanks, Vlatko, I thought that namespace thing looked familiar...
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  8. #8
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    BSTR is more similar to LPTSTR - it's basically an OLECHAR* array. COM in C++ supports the bstr_t wrapper class that acts a bit like basic_string<OLECHAR>.

    Useful but pointless information:

    string is actually a typedef for basic_string<char>, so you can make a string equivalent of LPTSTR by using typedef basic_string<TCHAR> tstring.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  9. #9
    Guest

    Re: WOW!

    Originally posted by crptcblade
    If you were here I'd be bending you over my desk and dry-humping you right now!

    Thanks, Vlatko, I thought that namespace thing looked familiar...
    Ok, thats a little sick!!!

    sorry I don't have anything useful to contribute.. but thats just sick...

    hehehe, and I can't stop laughing

  10. #10

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    That's me Dennis...

    {Sing along}I'm just a little monkey here to make you laugh...{end of Sing along}
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width