?? config.c
字號:
/* File: config.c */ /* Config File Contents: [Global] 數量=20 價格=8900 品牌=Compaq 硬件=顯示器 鼠標 鍵盤\\ */ #include <gnome.h> #define PACKAGE "TestGnome" #define VERSION "1.0" void save_settings() { const char *values[] = {"顯示器", "鼠標", "鍵盤 "}; gnome_config_push_prefix ("/"PACKAGE"/Global/"); gnome_config_set_int ("數量", 20); gnome_config_set_int ("價格", 8900); gnome_config_set_string ("品牌", "Compaq"); gnome_config_set_vector("硬件", 3, values); gnome_config_pop_prefix (); gnome_config_sync (); } void get_settings() { int i; int amount, price; char *brand; int len; char **vec; printf("Get Config from file:%s\n", gnome_config_get_real_path(PACKAGE)); gnome_config_push_prefix ("/"PACKAGE"/Global/"); amount = gnome_config_get_int ("數量"); price = gnome_config_get_int ("價格"); brand = gnome_config_get_string("品牌"); printf("數量:%d 價格:%d 品牌:%s\n", amount, price, brand); gnome_config_get_vector("硬件", &len, &vec); for(i=0; i<len; i++) printf("item:%s\n", vec[i]); gnome_config_pop_prefix (); gnome_config_sync (); } int main(int argc, char **argv) { //初始化 gnome_init(PACKAGE, VERSION, argc, argv); save_settings(); get_settings(); return 0; }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -