getprop.c
来自「Android 一些工具」· C语言 代码 · 共 35 行
C
35 行
#include <stdio.h>#include <cutils/properties.h>#include <sys/system_properties.h>static void proplist(const char *key, const char *name, void *user __attribute__((unused))){ printf("[%s]: [%s]\n", key, name);}int __system_property_wait(prop_info *pi);int getprop_main(int argc, char *argv[]){ int n = 0; if (argc == 1) { (void)property_list(proplist, NULL); } else { char value[PROPERTY_VALUE_MAX]; char *default_value; if(argc > 2) { default_value = argv[2]; } else { default_value = ""; } property_get(argv[1], value, default_value); printf("%s\n", value); } return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?