Strange Error with Glib::ustring



When i try to compile this code:


#include <iostream>

#include <glibmm.h>

int main(int argc, char *argv[])
{
        Glib::ustring mystring = "Hallo Welt";

        std::string::size_type stelle = mystring.find(" ");

        if ( stelle < mystring.length() )
        {
                std::cout << stelle << std::endl;
                mystring.insert(stelle,"\");
        }
        return 0;
}


Compile command:

g++ main.cc -pthread -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -pthread -lglibmm-2.4 -lgobject-2.0 -lsigc-2.0 -lgthread-2.0 -lrt -lglib-2.0 -o replaceString

I get this error:

main.cc:14: warning: missing terminating " character
main.cc:14: error: missing terminating " character
main.cc: In function ‘int main(int, char**)’:
main.cc:15: error: expected primary-_expression_ before ‘}’ token
main.cc:15: error: expected ‘;’ before ‘}’ token


In this little program i try to replace all spaces in the string with "\ ". Because if you use a space character in a path on the command line it doesn't work. You must always use "/home/user/some\ directory/second\ directory" instead of "/home/user/some directory/second directory". Maybe you have an better idea to solve this problem. 


Thott Chief 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]