Yes it is.
I cant even begin to understand the line of code mir posted, heh.
Yes it is.
I cant even begin to understand the line of code mir posted, heh.
It is too clear and so it is hard to see.
A dunce once searched for fire with a lighted lantern.
Had he known what fire was,
He could have cooked his rice much sooner.
Yes it is.
I can't even begin to comprehend the line of code mir posted, haha.
EDIT: I know about second pages, totally :\.
Thanks elysia, worked like a charm =).
The cast makes it even more horrible.
You shouldn't have to call a "transform" function just to convert each character in a string. It's a string class, so provide a tolower function, even if it's just in the std namespace. It could just be a wrapper for transform, but it should exist.
The more I find out about the standard library, the more poorly designed it seems to me. I'm just at odds with it.
What do you prefer to use? is there like an 'alternate STL'? Or do you just code it all from scratch yourself @_@?
Sigh heh. Ok, now I'm getting segfaults. My intuition (which is often wrong as a novice programmer) tells me that it has to do with the fact that I'm calling this Crawl function from within itself...yet using an infile stream. I.e.
Crawl instance 1 calls crawl instance 2 with an ifs called next_page.
Crawl instance 2 then tries to call crawl instance 3 with an ifs ALSO called next_page. I just tried adding in a ifs.close() in the Crawl function before it calls any more, but that didn't fix it.
Any hints? :x I'll gladly provide any more information you need.
EDIT: On the topic of STL v MFC. So the...microsoft foundation library (?) has a better set of tools? Is it more widely used?
Segfault can mean a lot. If you don't have a debugger, try adding things such as cout to see if it's indeed a stack overflow.
Otherwise it can be memory corruption.
Posting code here can also help others help you debug your code.
Microsoft Foundation ClassesEDIT: Oh, also whats MFC stand for?
I wrote a nice long post to explain it all, but it got deleted when I accidentally pressed alt-left on my browser.
I will say this:
It does exactly what it says. Transform -- read convert -- each element in the range from the start to the end of the string, put the result in the target string -- which can be the same string . The conversion function is given as tolower. It helps to know that transform does elem=func(elem) for each element.
Last edited by King Mir; 04-03-2008 at 08:25 PM.
It is too clear and so it is hard to see.
A dunce once searched for fire with a lighted lantern.
Had he known what fire was,
He could have cooked his rice much sooner.
I'm fairly sure its memory corruption. I have a map of strings and a class called 'page' (i'm simulating a web crawler) and I just found out that none of the info is actually being stored in the map properly. When I try to access it, segfault.
>> So the...microsoft foundation library (?) has a better set of tools?
No.
They are different. One is standard and works everywhere you have a modern C++ compiler. MFC is for windows and Visual Studio only. If you have an MFC application for other reasons, then you might want to use some of the MFC containers, but otherwise stick to the standard classes.
Also, Elysia's opinion on the standard library interface is different than many C++ experts. Just because one person doesn't like the setup doesn't mean it's bad. (Of course, just because the C++ standards committee decided on the standard interface doesn't mean it's perfect either.)
EDIT: I'm a retard. Fixed. lol.
Last edited by Jozrael; 04-03-2008 at 07:47 PM.
Edit: Foot in mouth x2?
Last edited by Jozrael; 04-03-2008 at 08:29 PM.
I skipped the cast and it worked just fine. I wasn't aware of transform, t'is a little neater than the old brute force method.
Code:void lowerCase(std::string &s) { std::transform(s.begin(), s.end(), s.begin(), std::tolower); std::cout<<s; //Optional } lowerCase(anyString);