对象中的字符操作



我有以下字符串:"/local/usr/bin/conf.xml"。我想用"new_conf.xml"代替"conf.xml",这样我就得到了"/local/usr/bin/new_conf.xml"

知道如何使用对象吗?

谢谢!

使用GFile进行路径操作:

GFile *conf = g_file_new_for_path ("/local/usr/bin/conf.xml");
GFile *parent = g_file_get_parent (conf);
GFile *new_conf = g_file_get_child (parent, "new_conf.xml");
g_object_unref (conf);
g_object_unref (parent);

最新更新