int main(int argc, char ** argv)
{
std::string test("lala");
printf("%d", test.length());
return 0;
}
so is it just a worthless piece of crap (sure seems like it) or what am i doing wrong.
[edited by - billybob on March 17, 2003 3:51:18 AM]
std::string::size or length ARRRGGGH
i'm getting a crash in std::string::size or std::string::length NO MATTER WHAT I DO. every single freaking time crash and asks for strlen.asm. THIS crashes:
well if youre gonna use strings you shouldnt use printf one is C++ one is C
I would use std::cout << test.length() << std::endl; that could be your prob
I would use std::cout << test.length() << std::endl; that could be your prob
hmmmmmm. Tricky problem. Step down through the stack trace into the frame that calls strlen, and find out whether the arguments it''s passing in are valid.
How appropriate. You fight like a cow.
How appropriate. You fight like a cow.
What compiler and STL implementation are you using? The code, as you''ve posted it, looks fine.
msvc++ 6, don''t know what STL version it is. i know it should be fine but no matter what i do it never works. i''ve tried strlen("lala") and it works perfectly, so i have no idea why this doesn''t work.
Downloading STLPort would be a avoiding rather than solving the problem, but it might be your easiest way out.
Have you done any messing around with library linking? (Debug versus Release, Single-Threaded versus Multithreaded)
How appropriate. You fight like a cow.
Have you done any messing around with library linking? (Debug versus Release, Single-Threaded versus Multithreaded)
How appropriate. You fight like a cow.
Make sure you have all the MSVC STL fixes (see my signature) before proceeding, or download STLPort. You might even have a corrupt install somewhere.
[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]
[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement