Click to See Complete Forum and Search --> : string data type??
crptcblade
Feb 3rd, 2001, 01:30 PM
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??
Active
Feb 3rd, 2001, 01:45 PM
Should it not be..
#include <string.h>
???????
crptcblade
Feb 3rd, 2001, 01:47 PM
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...
SteveCRM
Feb 3rd, 2001, 01:59 PM
It used to work for me in CodeWarrior...someone said to try #include <string>
crptcblade
Feb 3rd, 2001, 02:52 PM
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?
Vlatko
Feb 3rd, 2001, 03:16 PM
Use This:
#include <string>
using namespace std;
....
string mystring;
mystring = "Something"
//and so on
crptcblade
Feb 3rd, 2001, 03:24 PM
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...
parksie
Feb 3rd, 2001, 05:08 PM
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.
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 ;)
crptcblade
Feb 3rd, 2001, 07:59 PM
{Sing along}I'm just a little monkey here to make you laugh...{end of Sing along}
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.