terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct NULL not valid
Abort (core dumped)
[Answered]Runtime Error. What is instance of 'std::logic_error'
Is anybody familiar with this error?
I yahooed and googled them but apparently, no information was available.
[Edited by - Tradone on April 3, 2006 10:07:20 PM]
That is one of the standard exception classes. You are constructing an std::string with a null character pointer. Can you post your code?
jfl.
jfl.
it's about 25 files all together. urm... do I have to still post it?
can you give me an example of what might have been done?
and where can I get information on standard runtime errors like those?
i searched them in the engines and i got no matches. :(
can you give me an example of what might have been done?
and where can I get information on standard runtime errors like those?
i searched them in the engines and i got no matches. :(
okay, i fixed it
Error:
No Error:
Difference:
Thanks!
and if you can just leave me a reference site for the runtime errors.
Error:
Function Parameter::GetData(){ long count = 0; inputData = ""; char ch; while (count < envVars.contentLength){ cin.get(ch); inputData += ch; count++; } if (inputData == "" ) return Failure; return Success;}
No Error:
Function Parameter::GetData(){ long count = 0; inputData = ""; char ch; while (count < envVars.contentLength){ cin.get(ch); inputData += ch; count++; } return Success;}
Difference:
if (inputData == "" ) return Failure;
Thanks!
and if you can just leave me a reference site for the runtime errors.
If you still want to check if it's a failure, simply check the string's length (>0).
Now, is the compiler assuming that "" is NULL? I thought it would be considered as {'\0'} or something like that...
Now, is the compiler assuming that "" is NULL? I thought it would be considered as {'\0'} or something like that...
Quote:Original post by deadimp
If you still want to check if it's a failure, simply check the string's length (>0).
Well, we don't even know what inputData, Success, Failure or Function are, so it's hard to pinpoint what he may be doing wrong.
Quote:Now, is the compiler assuming that "" is NULL?
No.
Quote:I thought it would be considered as {'\0'} or something like that...
Yes.
Sorry, but I'm still not getting it. How does that conditional have anything to do with NULL character array initialization?
(My brain left after school)
(My brain left after school)
Quote:Original post by Tradone
and if you can just leave me a reference site for the runtime errors.
Well, there's always MSDN, but it looks like you're using something like GCC, so maybe the libstdc++ reference.
jfl.
Function Parameter::GetData(){ long count = 0; inputData = ""; char ch; while (count < envVars.contentLength){ cin.get(ch); inputData += ch; count++; } if (inputData == "" ) return Failure; return Success;}Function Parameter::SetParameter(){ string s; if (!GetData()) return Failure; s = inputData + "&";
[lol]
Seems like I left you guys all puzzled for not showing the whole thing.
okay. here it is.
So the I found out that Parameter::SetParameter() was the method with fault.
Thus, by adding
if (inputData == "" ) return Failure;
I don't have to execute this code.
s = inputData + "&";
and inputData is a private member variable of the class Parameter.
So since inputData = ""
I am trying to do
s = "" + "&"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement