This program uses C language to read properties files in a format similar to the following. Path =/etc/wgetrclaunch_on_start = true next version goals: (1) Use a pointer to replace two-dimensional data or reduce the capacity of two-dimensional data to a minimum requirement. (2) Ignore all spaces, ignore empty lines and comment lines (3) header file standard writing. File 1: main. c [cpp] # include <stdio. h> # include "read_properties.h" int main (void) {char names [100] [100], values [100] [100]; read_properties ("/home/lujinhong/scripts/projects/read_properties_file/test. properties ", names, values); return 0;} file 2: read_properties.h [cpp] void read_properties (char * pathname, char names [100] [100], char values [100] [100]); file 3: read_properties.c [cpp]/************************* **************************************** * *** This file is used to read the names and values from a properties file, * and store them in an array. **************************************** * **************************/# include "read_properties.h" # include <stdio. h> # include <unistd. h> # include "utils. h "void read_properties (char * pathname, char names [100] [100], char values [100] [100]) {FILE * file; Char line [100]; int I = 0; file = fopen (pathname, "r"); while (fgets (line, 100, file )) {printf ("% s", line); // just for test, delete it later. parseline (line, names [I], values [I]); I ++;} fclose (file);} file 4: utils. h [cpp] void parseline (char * line, char * name, char * value); File 5: utils. c [cpp] Using * Parse content of the line, and stor E the name and value. * line example: path =/etc/wgetrc ********************************** * ***********************/void parseline (char * line, char * name, char * value) {int length = 0, equal = 1; // equal will record the location of the '= 'Char * begin; length = strlen (line); for (begin = line; * begin! = '& Equal <= length; begin ++) {equal ++;} strncpy (name, line, equal-1); line + = equal; strncpy (value, line, length-equal); printf ("name = % s value = % s \ n", name, value); // just for test, delete it later .} running result: [plain] path =/etc/wgetrc name = path value =/etc/wgetrc launch_on_boot = true name = launch_on_boot value = true