Pregunta

I have the following config file:

 [GENERAL_CONFIG]
    filter_subnetworks = 192.168.105.0/24 1.1.0.0/16 192.168.105.0/24
    192.168.105.0/24 1.1.0.0/16 192.168.105.0/24 
    192.168.105.0/24 1.1.0.0/16 192.168.105.0/24 

and i want to read all subnetworks with g_key_file_get_string_list (gkf, "GENERAL_CONFIG", "filter_subnetworks", &s_len, &error) but this function read one single line.

¿Fue útil?

Solución

It looks like your input file doesn't comply with the formatting required by the glib Key-value file parser functions.

All key values should be on a single line, and you should have an explicit list separator character (not just space) such as ; or ,, see the g_key_file_set_list_separator() function.

Convert the file to comply with the required glib format if you're going to use their API. Note that as soon as you save your file back out, it will use the glib API, so there's little point in "tricking" it to load something else.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top