std::basic_string<wchar_t>: segmentation fault while accessing any member functions

M

mufasa

have a type given by:

typedef std::basic_string<wchar_t> mystringtype;

at one instacne of my program, i have a vairable called 'abc' of type
mystringtype. When i try to access the .c_str() or even .length()
functions, I get a segmentation fault. Is there a way to check what
exists in 'abc' because it's definitely holding something .. though
looks like some corrupt memory address ..
 
M

Maxim Yegorushkin

have a type given by:

typedef std::basic_string<wchar_t> mystringtype;

at one instacne of my program, i have a vairable called 'abc' of type
mystringtype. When i try to access the .c_str() or even .length()
functions, I get a segmentation fault.

Probably, you overwrited the memory used by the string.
Is there a way to check what
exists in 'abc' because it's definitely holding something .. though
looks like some corrupt memory address ..

Yes, use a debugger or dump the string's binary representation. Having
checked up the string implementation you can then map the binary dump with
string's members.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top