Help save net neutrality! Learn more.
Close

const char * filenames

2008-04-26
2013-05-02
  • Nobody/Anonymous

    Please start using const char * as arguments, std::string::c_str returns a const pointer.

     
    • Nobody/Anonymous

      Lack of "const char *" renders my code very ugly when I use std::string

        char* fn;
        fn = new char[filename.length()+1];
        memset(fn,'\0',filename.length()+1);
        filename.copy(fn,filename.length());
        result = ilutGLLoadImage(fn);
        delete[] fn;

       
      • Nobody/Anonymous

        Yeah, sorry about that. DevIL doesn't modify the string it gets, so you can do

          ilutGLLoadImage((char*)filename.c_str());

        Just as ugly, but at least it's shorter.

         

Log in to post a comment.