User forums > Help
debugger segmentation error with vector[1]
(1/1)
floppyfreak:
I don't think this is a bug, but how can I manage this situation:
--- Code: ---
bool TEclPrefIO::readPref()
{
vector<std::string> nodenames;
nodenames.push_back("sometext");
if (nodenames.size()>1)
std::string nix=nodenames[1];
return true;
}
int main()
{
TEclPrefIO tio;
if (!tio.readPref()) tio.writePref();
}
--- End code ---
(the code is a bit rudimentary, but it should be enough to illustrate)
The debugger reacts now in such a way, that it does not even enter the readPref() but stops with a segmentation error. Is there something like a #ifdef to prevent this?
Jenna:
Your question is not related to C::B in any way, and therefore violates our forum rules.
This forum is dedicated to C::B related questions only and not to general programming questions.
Please ask your question in an appropriate (c++ dedicated ) forum.
Topic locked !!
Navigation
[0] Message Index
Go to full version