   [SDL] Help me please!
  Hi guys! I've a question for you. I'm reading LazyFoo's tutorials (BTW.. they're really good!). There's a couple of things I don't understand (I'm a newbie with c++ yet). One of them is in the tutorial called "Surface Loading and Blitting". Here's the link with the code.I don't understand this line of code:loadedImage = SDL_LoadBMP( filename.c_str() );What's filename.c_str() ?? I know "filename" is the file which is introduced as argument in the function "load_image" but.. what's c_str() and why is the dot? It seems like filename was an object :S I know it's a newbie question but I want to start with SDL right now.Thanks for your help :)   
.c_str() is an attachment to your string to convert it to a char*. 'String' is newer than the laugage, and the old way was having a char* point to your words. The function, SDL_LoadBMP(), wants a char pointer, and .c_str() makes it easier on you and I, by converting our strings for us to that datatype. Otherwise we would have to convert it ourselves before passing it to the function.   ;  filename is a std::string.Quote:SDL_Surface *load_image( std::string filename ) std::string is a class that represents text in you application.The c_str() is a member function. It gives you a "raw array" back. This is useful because C apis like SDL_TTF do not know about std::strings. You can use c_str() to pass it the text in a way it can read. the '.' Quote:It seems like filename was an objectYes. Thats it exactly. There are other helpful member functions, like length() or size() which give you a count of the number of characters in the string.   ;  Ahhh got it, thanks! but.. one more question. Why is "filename.c_str()" and is not "c_str(filename)"? Is filename an object of class "string" and this is the way we have to call its member function? I'm very confused :(Thank u in advance for your help :)   ;  Hahaha we post at the same time. Thank u! Both advices were very helpful for me.Cya later!   