常见系统数据文件
下表列出了常见的系统数据文件及其查找函数。
以/etc/passwd文件为例,读取数据的程序框架如下:
void get_pw_entry()
{
struct passwd *ptr;
setpwent();
while ((ptr = getpwent()) != 0) {
……
}
endpwe...
分类:
其他好文 时间:
2014-05-07 08:46:54
阅读次数:
341
#include
using namespace std;
class Base
{
public:
Base(){base = 1; cout
virtual ~Base(){cout
virtual void say(){cout
private:
int base;
static int count;
};...
分类:
编程语言 时间:
2014-05-07 06:59:24
阅读次数:
302
unsigned long get_free_page(void)
{
register unsigned long __res asm("ax");
repeat:
__asm__("std ; repne ; scasb\n\t"
"jne 1f\n\t"
"movb $1,1(%%edi)\n\t"
"sall $12...
分类:
系统相关 时间:
2014-05-07 05:38:18
阅读次数:
515
private static void sort1(int x[], int off, int len) {
// Insertion sort on smallest arrays //长度小于7,采用冒泡排序
if (len < 7) {
for (int i=off; ioff && x[j-1]>x[j];...
分类:
其他好文 时间:
2014-05-07 05:14:35
阅读次数:
279
在使用Unity的时候,很多时候是这样一种引用的关系。就是一个类需要另一个类在其中做工具类。因为是构造方法注入,所以要在构造方法中加入一个引用参数。
public interface IRepository
{
void Execute();
}
public class Repository : IRepository
{...
分类:
其他好文 时间:
2014-05-07 03:57:14
阅读次数:
299
#include
using namespace std;
//汉罗塔递归求解函数 从a移到c
void move(int m,char a,char c);
void hanoi(int n,char a,char b,char c)
{
if(1==n)
{
move(n,a,c);
return;
}
hanoi(n-1,a,c,b);
move(n,a,c);
hano...
分类:
其他好文 时间:
2014-05-07 03:24:14
阅读次数:
228
如果读到的是音频文件路径,需要先将音乐文件插入到多媒体库。如:path传入:/mnt/sdcard/mp3/a.mp3
//设置--铃声的具体方法 public void setMyRingtone(String path) { File sdfile = new File(path); ContentValues values = new Co...
分类:
移动开发 时间:
2014-05-06 22:55:52
阅读次数:
500
如果有下面的一个笔试题:
已知我们有如下的调用关系
logIt(”log message 1 “);
logIt(”log message2”,"log message3”);
logIt(”log message4”,"log message5”,"log message6");
请问下面的答案中哪个是正确的
A. public void logIt(String * ms...
分类:
编程语言 时间:
2014-05-06 15:34:03
阅读次数:
290
public staticvoid main(String[] args)为Java程序的入口方法,JVM在运行程序的时候,会首先查找main方法...
分类:
编程语言 时间:
2014-05-06 15:28:40
阅读次数:
381
应对的情况:当一个可观察者的状态发生改变时,观察者的数据也要实时更新。
你可能第一时间会想到的是,直接在可观察者类上调用观察者的方法就行了。是的,这是一种最直接,也是最简单的方法。但这样做就使得可观察者和观察者的耦合性很高,且不能动态更改观察者的数量。
我们或许可以这样做,写一个可观察者的接口:
public interface Subject {
public void...
分类:
其他好文 时间:
2014-05-06 14:58:55
阅读次数:
222