Link to home
Start Free TrialLog in
Avatar of tommym121
tommym121Flag for Canada

asked on

How to deal with std::wstring with Visual Studio

i am designing a program to read records of data into a vector of structure

typedef struct _recordEntry
{
  wstring  name;
  wstring  description;
  int         ID;
}  RECORDENTRY;

In the file,  I have records like the following
name1, "This is name1 description", 123
name2, "This is name2 description", 234
name3, "This is name3 description", 345

I am trying to read in a line at a time, then tokenize using boost::tokenizer.

My question is how do I create a visual studio project that will use wstring and how can I use corresponding boost::tokenizer that is for wstring?
Avatar of tommym121
tommym121
Flag of Canada image

ASKER

I was able to read in but when I try to

RECORDENTRY *pRecordEntry;


std::cout  << "Record:  "<< pRecordEntry->name << ";" << pRecordEntry->description << std::endl;

I got this out put

Record: 00C50A0C;00C53790
But when I  'Add Watch" to view the contenct , the right info is inside the structure.

How do I display wstring content?
SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
BTW, you get 'Record: 00C50A0C;00C53790' because 'cout' interprets UNICODE strings as a hexadecimal value. That's why you need 'wcout' instead, as it interprets them correctly as UNICODE text.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks